Behavior Refactoring

Behaviors and PerformanceStats are no longer associated solely with Ships, instead there's a generic Entity class which will also be used for stations and turrets.
This commit is contained in:
hyperion51 2020-04-09 10:33:16 +01:00
commit 7cd24147ae
41 changed files with 544 additions and 341 deletions

View file

@ -0,0 +1,48 @@
using MessagePack;
using Newtonsoft.Json;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ShieldData : IBehaviorData
{
[InspectableField, JsonProperty("efficiency"), Key(0)]
public PerformanceStat Efficiency = new PerformanceStat();
[InspectableField, JsonProperty("shielding"), Key(1)]
public PerformanceStat Shielding = new PerformanceStat();
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
{
return new Shield(context, this, entity, item);
}
}
public class Shield : IBehavior
{
public Entity Entity { get; }
public Gear Item { get; }
public GameContext Context { get; }
public IBehaviorData Data => _data;
private ShieldData _data;
public Shield(GameContext context, ShieldData data, Entity entity, Gear item)
{
Context = context;
_data = data;
Entity = entity;
Item = item;
// TODO: Detect hits on Ship, keep a list of callbacks that modify the hit by reference
}
public void Initialize()
{
}
public void Update(float delta)
{
}
}