Removed universal GameContext references Refactored GameContext: It's now only responsible for item management. As such it's now called ItemManager GlobalData is gone, relevant settings are distributed amongst specialized settings classes Entities are no longer database entries, references to them are now direct - Zone is reponsible for storing them in ZonePacks Controller subtypes are now generic classes, class argument is task type Inventory is now a 2D grid instead of a list Entity temperature is now a 2D grid instead of a number Item sizes are now arbitrary shapes instead of a number Hardpoints are now arbitrary shapes instead Equipped items have their own temperatures Map view now displays sunlight colors Integrated Allegorithmic Substance Plugin Imported Djinni ship and assigned Substance materials Removed Node Editor framework (might come back later but needs work to integrate with behavior system)
44 lines
No EOL
1.2 KiB
C#
44 lines
No EOL
1.2 KiB
C#
using MessagePack;
|
|
using Newtonsoft.Json;
|
|
|
|
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
|
public class HitscanData : WeaponData
|
|
{
|
|
[InspectableField, JsonProperty("perSecond"), Key(6)]
|
|
public bool PerSecond;
|
|
|
|
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem 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 EquippedItem Item { get; }
|
|
private ItemManager Context { get; }
|
|
private float _firingVisibility;
|
|
|
|
public BehaviorData Data => _data;
|
|
public float Range { get; private set; }
|
|
|
|
public Hitscan(ItemManager context, HitscanData c, Entity entity, EquippedItem item)
|
|
{
|
|
Context = context;
|
|
_data = c;
|
|
Entity = entity;
|
|
Item = item;
|
|
}
|
|
|
|
public bool Update(float delta)
|
|
{
|
|
// TODO: Implement hitscan weapons!
|
|
Range = Context.Evaluate(_data.Range, Item.EquippableItem, Entity);
|
|
return true;
|
|
}
|
|
|
|
} |