Item behaviors are now separated into more granular units, allowing designers to create more interesting items by combining behaviors
38 lines
No EOL
908 B
C#
38 lines
No EOL
908 B
C#
using MessagePack;
|
|
using Newtonsoft.Json;
|
|
|
|
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
|
public class HitscanData : WeaponData
|
|
{
|
|
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
|
{
|
|
return new Hitscan(context, this, entity, item);
|
|
}
|
|
}
|
|
|
|
public class Hitscan : IBehavior
|
|
{
|
|
private bool _firing;
|
|
private float _cooldown; // normalized
|
|
private HitscanData _data;
|
|
private Entity Entity { get; }
|
|
private Gear Item { get; }
|
|
private GameContext Context { get; }
|
|
private float _firingVisibility;
|
|
|
|
public BehaviorData Data => _data;
|
|
|
|
public Hitscan(GameContext context, HitscanData c, Entity entity, Gear item)
|
|
{
|
|
Context = context;
|
|
_data = c;
|
|
Entity = entity;
|
|
Item = item;
|
|
}
|
|
|
|
public bool Update(float delta)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
} |