Reflected Visibility
Ships are now more visible in lit areas (depending on cross section stat in Reflector behavior) Refactored all behaviors to remove context & entity references (can get them from equipped item reference if needed) Fixed crash when enemy dies of heatstroke while targeted Exponential decay for visibility now uses correct time-independent formula Refactored item inspection in properties panel (now consistent between equipped items vs. inventory and store items, shows effect of heat on stats) Reordered item properties and added spacing between groups
This commit is contained in:
parent
b0b2717294
commit
a51c402fc5
59 changed files with 557 additions and 1405 deletions
|
|
@ -16,17 +16,15 @@ public class ShieldData : BehaviorData
|
|||
[Inspectable, JsonProperty("energy"), Key(2), RuntimeInspectable]
|
||||
public PerformanceStat EnergyUsage = new PerformanceStat();
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
public override IBehavior CreateInstance(EquippedItem item)
|
||||
{
|
||||
return new Shield(context, this, entity, item);
|
||||
return new Shield(this, item);
|
||||
}
|
||||
}
|
||||
|
||||
public class Shield : IBehavior
|
||||
{
|
||||
public Entity Entity { get; }
|
||||
public EquippedItem Item { get; }
|
||||
public ItemManager Context { get; }
|
||||
|
||||
public float Efficiency { get; private set; }
|
||||
public float EnergyUsage { get; private set; }
|
||||
|
|
@ -35,11 +33,9 @@ public class Shield : IBehavior
|
|||
|
||||
private ShieldData _data;
|
||||
|
||||
public Shield(ItemManager context, ShieldData data, Entity entity, EquippedItem item)
|
||||
public Shield(ShieldData data, EquippedItem item)
|
||||
{
|
||||
Context = context;
|
||||
_data = data;
|
||||
Entity = entity;
|
||||
Item = item;
|
||||
}
|
||||
|
||||
|
|
@ -52,12 +48,12 @@ public class Shield : IBehavior
|
|||
|
||||
public bool CanTakeHit(DamageType type, float damage)
|
||||
{
|
||||
return Entity.CanConsumeEnergy(damage * EnergyUsage);
|
||||
return Item.Entity.CanConsumeEnergy(damage * EnergyUsage);
|
||||
}
|
||||
|
||||
public void TakeHit(DamageType type, float damage)
|
||||
{
|
||||
Entity.TryConsumeEnergy(damage * EnergyUsage);
|
||||
Item.Entity.TryConsumeEnergy(damage * EnergyUsage);
|
||||
Item.AddHeat(damage / Efficiency);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue