2020-04-09 07:48:45 +01:00
|
|
|
using MessagePack;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Unity.Mathematics;
|
|
|
|
|
using static Unity.Mathematics.math;
|
|
|
|
|
|
2020-05-31 03:10:11 +01:00
|
|
|
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
2020-05-06 04:56:36 +01:00
|
|
|
public class ShieldData : BehaviorData
|
2020-04-09 07:48:45 +01:00
|
|
|
{
|
2020-05-31 03:10:11 +01:00
|
|
|
[InspectableField, JsonProperty("efficiency"), Key(1), RuntimeInspectable]
|
2020-04-09 07:48:45 +01:00
|
|
|
public PerformanceStat Efficiency = new PerformanceStat();
|
|
|
|
|
|
2020-05-31 03:10:11 +01:00
|
|
|
[InspectableField, JsonProperty("shielding"), Key(2), RuntimeInspectable]
|
2020-04-09 07:48:45 +01:00
|
|
|
public PerformanceStat Shielding = new PerformanceStat();
|
|
|
|
|
|
2020-12-10 23:20:38 +00:00
|
|
|
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
2020-04-09 07:48:45 +01:00
|
|
|
{
|
2020-04-09 10:33:16 +01:00
|
|
|
return new Shield(context, this, entity, item);
|
2020-04-09 07:48:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-09 10:33:16 +01:00
|
|
|
public class Shield : IBehavior
|
2020-04-09 07:48:45 +01:00
|
|
|
{
|
2020-04-09 10:33:16 +01:00
|
|
|
public Entity Entity { get; }
|
2020-12-10 23:20:38 +00:00
|
|
|
public EquippedItem Item { get; }
|
|
|
|
|
public ItemManager Context { get; }
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2020-05-06 04:56:36 +01:00
|
|
|
public BehaviorData Data => _data;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2020-04-09 10:33:16 +01:00
|
|
|
private ShieldData _data;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2020-12-10 23:20:38 +00:00
|
|
|
public Shield(ItemManager context, ShieldData data, Entity entity, EquippedItem item)
|
2020-04-09 07:48:45 +01:00
|
|
|
{
|
|
|
|
|
Context = context;
|
|
|
|
|
_data = data;
|
2020-04-09 10:33:16 +01:00
|
|
|
Entity = entity;
|
2020-04-09 07:48:45 +01:00
|
|
|
Item = item;
|
|
|
|
|
|
|
|
|
|
// TODO: Detect hits on Ship, keep a list of callbacks that modify the hit by reference
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 01:17:10 +01:00
|
|
|
public bool Update(float delta)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2020-04-09 07:48:45 +01:00
|
|
|
}
|