Massive Item Behavior Refactoring
Item behaviors are now separated into more granular units, allowing designers to create more interesting items by combining behaviors
This commit is contained in:
parent
fc94531566
commit
8cd4ea3dc5
40 changed files with 822 additions and 445 deletions
40
Assets/Scripts/ServerShared/Behaviors/Switch.cs
Normal file
40
Assets/Scripts/ServerShared/Behaviors/Switch.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class SwitchData : BehaviorData
|
||||
{
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Switch(context, this, entity, item);
|
||||
}
|
||||
}
|
||||
|
||||
[UpdateOrder(-25)]
|
||||
public class Switch : IBehavior
|
||||
{
|
||||
private SwitchData _data;
|
||||
|
||||
private Entity Entity { get; }
|
||||
private Gear Item { get; }
|
||||
private GameContext Context { get; }
|
||||
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private bool Activated { get; set; }
|
||||
|
||||
public Switch(GameContext context, SwitchData data, Entity entity, Gear item)
|
||||
{
|
||||
_data = data;
|
||||
Entity = entity;
|
||||
Item = item;
|
||||
Context = context;
|
||||
}
|
||||
|
||||
public bool Update(float delta)
|
||||
{
|
||||
return Activated;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue