Added child selection and child inventory panel to colony tab, and implemented drag and drop functionality between parent and child inventories
45 lines
No EOL
1.2 KiB
C#
45 lines
No EOL
1.2 KiB
C#
using System;
|
|
using System.Linq;
|
|
using MessagePack;
|
|
using Newtonsoft.Json;
|
|
|
|
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(-22)]
|
|
public class ThermotoggleData : BehaviorData
|
|
{
|
|
[TemperatureInspectable, JsonProperty("targetTemp"), Key(1)]
|
|
public float TargetTemperature;
|
|
|
|
[InspectableField, JsonProperty("highPass"), Key(2)]
|
|
public bool HighPass;
|
|
|
|
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
|
{
|
|
return new Thermotoggle(context, this, entity, item);
|
|
}
|
|
}
|
|
|
|
public class Thermotoggle : IBehavior
|
|
{
|
|
public float TargetTemperature;
|
|
private ThermotoggleData _data;
|
|
|
|
private Entity Entity { get; }
|
|
private Gear Item { get; }
|
|
private GameContext Context { get; }
|
|
|
|
public BehaviorData Data => _data;
|
|
|
|
public Thermotoggle(GameContext context, ThermotoggleData data, Entity entity, Gear item)
|
|
{
|
|
_data = data;
|
|
Entity = entity;
|
|
Item = item;
|
|
Context = context;
|
|
TargetTemperature = data.TargetTemperature;
|
|
}
|
|
|
|
public bool Update(float delta)
|
|
{
|
|
return Entity.Temperature < TargetTemperature ^ _data.HighPass;
|
|
}
|
|
} |