Entity Persistence Refactoring
Entities refactored to enable robust persistence Entities detect stale data references and reload behaviors
This commit is contained in:
parent
87acc75b96
commit
6aeb2ae280
29 changed files with 299 additions and 202 deletions
|
|
@ -5,7 +5,7 @@ using MessagePack;
|
|||
using Newtonsoft.Json;
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class AfterburnerData : IBehaviorData
|
||||
public class AfterburnerData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("thrust"), Key(0)]
|
||||
public PerformanceStat ThrustModifier = new PerformanceStat();
|
||||
|
|
@ -16,7 +16,7 @@ public class AfterburnerData : IBehaviorData
|
|||
[InspectableField, JsonProperty("torque"), Key(2)]
|
||||
public PerformanceStat TorqueModifier = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Afterburner(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ public class Afterburner : IActivatedBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
public Afterburner(GameContext context, AfterburnerData data, Entity entity, Gear item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public interface IBehavior
|
|||
Entity Entity { get; }
|
||||
Gear Item { get; }
|
||||
GameContext Context { get; }
|
||||
IBehaviorData Data { get; }
|
||||
BehaviorData Data { get; }
|
||||
}
|
||||
|
||||
public interface IActivatedBehavior : IBehavior
|
||||
|
|
@ -35,9 +35,14 @@ public interface IPersistentBehavior//<T> where T : IBehavior
|
|||
PersistentBehaviorData Store();
|
||||
void Restore(PersistentBehaviorData data);
|
||||
}
|
||||
[Union(0, typeof(FactoryPersistence)),
|
||||
|
||||
[MessagePackObject,
|
||||
Union(0, typeof(FactoryPersistence)),
|
||||
JsonObject(MemberSerialization.OptIn),
|
||||
JsonConverter(typeof(JsonKnownTypesConverter<PersistentBehaviorData>))]
|
||||
public class PersistentBehaviorData { }
|
||||
public abstract class PersistentBehaviorData
|
||||
{
|
||||
}
|
||||
|
||||
[InspectableField,
|
||||
Union(0, typeof(ProjectileWeaponData)),
|
||||
|
|
@ -53,8 +58,11 @@ public class PersistentBehaviorData { }
|
|||
Union(10, typeof(VelocityConversionData)),
|
||||
Union(11, typeof(VelocityLimitData)),
|
||||
Union(12, typeof(FactoryData)),
|
||||
JsonConverter(typeof(JsonKnownTypesConverter<IBehaviorData>)), JsonObject(MemberSerialization.OptIn)]
|
||||
public interface IBehaviorData
|
||||
JsonConverter(typeof(JsonKnownTypesConverter<BehaviorData>)), JsonObject(MemberSerialization.OptIn)]
|
||||
public abstract class BehaviorData
|
||||
{
|
||||
IBehavior CreateInstance(GameContext context, Entity entity, Gear item);
|
||||
// [InspectableField, JsonProperty("index"), Key(0)]
|
||||
// public int Index;
|
||||
|
||||
public abstract IBehavior CreateInstance(GameContext context, Entity entity, Gear item);
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ using static Unity.Mathematics.math;
|
|||
using Random = Unity.Mathematics.Random;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class FactoryData : IBehaviorData
|
||||
public class FactoryData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("toolingTime"), Key(0)]
|
||||
public PerformanceStat ToolingTime = new PerformanceStat();
|
||||
|
|
@ -16,7 +16,7 @@ public class FactoryData : IBehaviorData
|
|||
[InspectableField, JsonProperty("automation"), Key(1)]
|
||||
public int AutomationPoints;
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Factory(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private FactoryData _data;
|
||||
|
||||
|
|
@ -109,28 +109,28 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
|
|||
};
|
||||
}
|
||||
Context.Cache.Add(newItem);
|
||||
Entity.Cargo.Add(newItem);
|
||||
Entity.Cargo.Add(newItem.ID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var simpleCommodityData = blueprintItemData as SimpleCommodityData;
|
||||
var simpleCommodityInstance = Entity.Cargo.FirstOrDefault(i => i.Data == simpleCommodityData.ID) as SimpleCommodity;
|
||||
if (simpleCommodityInstance == null)
|
||||
var simpleCommodityInstance = Entity.Cargo.FirstOrDefault(i => i == simpleCommodityData.ID);
|
||||
if (simpleCommodityInstance == Guid.Empty)
|
||||
{
|
||||
simpleCommodityInstance = new SimpleCommodity
|
||||
var newSimpleCommodity = new SimpleCommodity
|
||||
{
|
||||
Context = Context,
|
||||
Data = simpleCommodityData.ID,
|
||||
ID = Guid.NewGuid(),
|
||||
Quantity = blueprint.Quantity
|
||||
};
|
||||
Context.Cache.Add(simpleCommodityInstance);
|
||||
Entity.Cargo.Add(simpleCommodityInstance);
|
||||
Context.Cache.Add(newSimpleCommodity);
|
||||
Entity.Cargo.Add(newSimpleCommodity.ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
simpleCommodityInstance.Quantity += blueprint.Quantity;
|
||||
Context.Cache.Get<SimpleCommodity>(simpleCommodityInstance).Quantity += blueprint.Quantity;
|
||||
}
|
||||
}
|
||||
Entity.RecalculateMass();
|
||||
|
|
@ -138,15 +138,15 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
|
|||
var simpleIngredients = new List<SimpleCommodity>();
|
||||
var compoundIngredients = new List<CompoundCommodity>();
|
||||
var hasAllIngredients = true;
|
||||
var cargoInstances = Entity.Cargo.Select(c => Context.Cache.Get<ItemInstance>(c));
|
||||
foreach (var kvp in blueprint.Ingredients)
|
||||
{
|
||||
var itemData = Context.Cache.Get(kvp.Key);
|
||||
if (itemData is SimpleCommodityData)
|
||||
{
|
||||
var matchingItem = Entity.Cargo.FirstOrDefault(ii =>
|
||||
var matchingItem = cargoInstances.FirstOrDefault(ii =>
|
||||
{
|
||||
var simpleCommodity = ii as SimpleCommodity;
|
||||
if (simpleCommodity == null) return false;
|
||||
if (!(ii is SimpleCommodity simpleCommodity)) return false;
|
||||
return simpleCommodity.Data == itemData.ID && simpleCommodity.Quantity >= kvp.Value;
|
||||
}) as SimpleCommodity;
|
||||
hasAllIngredients = hasAllIngredients && matchingItem != null;
|
||||
|
|
@ -156,10 +156,10 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
|
|||
else
|
||||
{
|
||||
var matchingItems =
|
||||
Entity.Cargo.Where(ii => (ii as CompoundCommodity)?.Data == itemData.ID).Cast<CompoundCommodity>().ToArray();
|
||||
cargoInstances.Where(ii => (ii as CompoundCommodity)?.Data == itemData.ID).Cast<CompoundCommodity>().ToArray();
|
||||
hasAllIngredients = hasAllIngredients && matchingItems.Length >= kvp.Value;
|
||||
if(matchingItems.Length >= kvp.Value)
|
||||
compoundIngredients.AddRange(matchingItems);
|
||||
compoundIngredients.AddRange(matchingItems.Take(kvp.Value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
|
|||
_reservedStock.AddRange(compoundIngredients);
|
||||
foreach (var compoundCommodity in compoundIngredients)
|
||||
{
|
||||
Entity.Cargo.Remove(compoundCommodity);
|
||||
Entity.Cargo.Remove(compoundCommodity.ID);
|
||||
}
|
||||
foreach (var simpleCommodity in simpleIngredients)
|
||||
{
|
||||
|
|
@ -177,7 +177,7 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
|
|||
if (simpleCommodity.Quantity == blueprintQuantity)
|
||||
{
|
||||
_reservedStock.Add(simpleCommodity);
|
||||
Entity.Cargo.Remove(simpleCommodity);
|
||||
Entity.Cargo.Remove(simpleCommodity.ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -230,11 +230,11 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
|
|||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class FactoryPersistence : PersistentBehaviorData
|
||||
{
|
||||
public Guid Blueprint;
|
||||
public float RemainingManHours;
|
||||
public bool Retooling;
|
||||
public bool Producing;
|
||||
public Guid[] ReservedStock;
|
||||
public int AssignedPopulation;
|
||||
public float ProductionQuality;
|
||||
[JsonProperty("blueprint"), Key(0)] public Guid Blueprint;
|
||||
[JsonProperty("remainingManHours"), Key(1)] public float RemainingManHours;
|
||||
[JsonProperty("retooling"), Key(2)] public bool Retooling;
|
||||
[JsonProperty("producing"), Key(3)] public bool Producing;
|
||||
[JsonProperty("reservedStock"), Key(4)] public Guid[] ReservedStock;
|
||||
[JsonProperty("assignedPopulation"), Key(5)] public int AssignedPopulation;
|
||||
[JsonProperty("productionQuality"), Key(6)] public float ProductionQuality;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class LauncherData : IBehaviorData
|
||||
public class LauncherData : BehaviorData
|
||||
{
|
||||
[InspectablePrefab, JsonProperty("missile"), Key(9)]
|
||||
public string MissilePrefab;
|
||||
|
|
@ -37,7 +37,7 @@ public class LauncherData : IBehaviorData
|
|||
[InspectableField, JsonProperty("lockOnTime"), Key(18)]
|
||||
public PerformanceStat LockOnTime = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Launcher(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -162,5 +162,5 @@ public class Launcher : IActivatedBehavior
|
|||
// }
|
||||
}
|
||||
|
||||
public IBehaviorData Data => _launcher;
|
||||
public BehaviorData Data => _launcher;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ using MessagePack;
|
|||
using Newtonsoft.Json;
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class ProjectileWeaponData : WeaponData, IBehaviorData
|
||||
public class ProjectileWeaponData : WeaponData
|
||||
{
|
||||
[InspectablePrefab, JsonProperty("bullet"), Key(9)]
|
||||
public string BulletPrefab;
|
||||
|
|
@ -16,7 +16,7 @@ public class ProjectileWeaponData : WeaponData, IBehaviorData
|
|||
[InspectableField, JsonProperty("bulletVelocity"), Key(12)]
|
||||
public PerformanceStat Velocity = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new ProjectileWeapon(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -97,5 +97,5 @@ public class ProjectileWeapon : IActivatedBehavior
|
|||
}
|
||||
}
|
||||
|
||||
public IBehaviorData Data => _projectileWeapon;
|
||||
public BehaviorData Data => _projectileWeapon;
|
||||
}
|
||||
|
|
@ -4,12 +4,12 @@ using Unity.Mathematics;
|
|||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class RadiatorData : IBehaviorData
|
||||
public class RadiatorData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("emissivity"), Key(0)]
|
||||
public PerformanceStat Emissivity = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Radiator(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ public class Radiator : IBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private RadiatorData _data;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using MessagePack;
|
|||
using Newtonsoft.Json;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class ReactorData : IBehaviorData
|
||||
public class ReactorData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("charge"), Key(0)]
|
||||
public PerformanceStat Charge = new PerformanceStat();
|
||||
|
|
@ -19,7 +19,7 @@ public class ReactorData : IBehaviorData
|
|||
[InspectableField, JsonProperty("underload"), Key(4)]
|
||||
public PerformanceStat UnderloadRecovery = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Reactor(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ public class Reactor : IBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
public Reactor(GameContext context, ReactorData data, Entity entity, Gear item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Unity.Mathematics;
|
|||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class ReflectorData : IBehaviorData
|
||||
public class ReflectorData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("crossSection"), Key(0)]
|
||||
public PerformanceStat CrossSection = new PerformanceStat();
|
||||
|
|
@ -12,7 +12,7 @@ public class ReflectorData : IBehaviorData
|
|||
// [InspectableAnimationCurve, JsonProperty("visibility"), Key(1)]
|
||||
// public float4[] VisibilityCurve;
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Reflector(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ public class Reflector : IBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private ReflectorData _data;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using MessagePack;
|
|||
using Newtonsoft.Json;
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class SensorData : IBehaviorData
|
||||
public class SensorData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("radiance"), Key(0)]
|
||||
public PerformanceStat Radiance = new PerformanceStat();
|
||||
|
|
@ -17,7 +17,7 @@ public class SensorData : IBehaviorData
|
|||
[InspectableField, JsonProperty("range"), Key(3)]
|
||||
public PerformanceStat Range = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Sensor(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ public class Sensor : IBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
public Sensor(GameContext context, SensorData data, Entity entity, Gear item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Unity.Mathematics;
|
|||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class ShieldData : IBehaviorData
|
||||
public class ShieldData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("efficiency"), Key(0)]
|
||||
public PerformanceStat Efficiency = new PerformanceStat();
|
||||
|
|
@ -12,7 +12,7 @@ public class ShieldData : IBehaviorData
|
|||
[InspectableField, JsonProperty("shielding"), Key(1)]
|
||||
public PerformanceStat Shielding = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Shield(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ public class Shield : IBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private ShieldData _data;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Unity.Mathematics;
|
|||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), EntityTypeRestriction(HullType.Ship)]
|
||||
public class ThrusterData : IBehaviorData
|
||||
public class ThrusterData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("thrust"), Key(0)]
|
||||
public PerformanceStat Thrust = new PerformanceStat();
|
||||
|
|
@ -15,7 +15,7 @@ public class ThrusterData : IBehaviorData
|
|||
[InspectableField, JsonProperty("heat"), Key(2)]
|
||||
public PerformanceStat Heat = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Thruster(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public class Thruster : IAnalogBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private ThrusterData _data;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Unity.Mathematics;
|
|||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class TurningData : IBehaviorData
|
||||
public class TurningData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("torque"), Key(0)]
|
||||
public PerformanceStat Torque = new PerformanceStat();
|
||||
|
|
@ -15,7 +15,7 @@ public class TurningData : IBehaviorData
|
|||
[InspectableField, JsonProperty("heat"), Key(2)]
|
||||
public PerformanceStat Heat = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Turning(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public class Turning : IAnalogBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private TurningData _data;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ using Unity.Mathematics;
|
|||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class VelocityConversionData : IBehaviorData
|
||||
public class VelocityConversionData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("traction"), Key(0)]
|
||||
public PerformanceStat Traction = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new VelocityConversion(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ public class VelocityConversion : IBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private VelocityConversionData _data;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ using Unity.Mathematics;
|
|||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class VelocityLimitData : IBehaviorData
|
||||
public class VelocityLimitData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("topSpeed"), Key(0)]
|
||||
public PerformanceStat TopSpeed = new PerformanceStat();
|
||||
|
||||
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new VelocityLimit(context, this, entity, item);
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ public class VelocityLimit : IBehavior
|
|||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public IBehaviorData Data => _data;
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private VelocityLimitData _data;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Newtonsoft.Json;
|
|||
|
||||
[Union(0, typeof(ProjectileWeaponData)),
|
||||
Union(1, typeof(LauncherData))]
|
||||
public abstract class WeaponData
|
||||
public abstract class WeaponData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("damageType"), Key(0)]
|
||||
public DamageType DamageType;
|
||||
|
|
|
|||
Loading…
Reference in a new issue