Properties panel now allows nested lists with foldouts, item selection and click callbacks Properties Panel UI has a new look Refactored lambdas in control module code into methods for readability
46 lines
No EOL
1.3 KiB
C#
46 lines
No EOL
1.3 KiB
C#
using MessagePack;
|
|
using Newtonsoft.Json;
|
|
using Unity.Mathematics;
|
|
using static Unity.Mathematics.math;
|
|
|
|
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
|
public class RadiatorData : BehaviorData
|
|
{
|
|
[InspectableField, JsonProperty("emissivity"), Key(1), RuntimeInspectable]
|
|
public PerformanceStat Emissivity = new PerformanceStat();
|
|
|
|
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
|
{
|
|
return new Radiator(context, this, entity, item);
|
|
}
|
|
}
|
|
|
|
public class Radiator : IBehavior
|
|
{
|
|
public Entity Entity { get; }
|
|
public Gear Item { get; }
|
|
public GameContext Context { get; }
|
|
|
|
public BehaviorData Data => _data;
|
|
|
|
public float Emissivity;
|
|
|
|
private RadiatorData _data;
|
|
|
|
public Radiator(GameContext context, RadiatorData data, Entity entity, Gear item)
|
|
{
|
|
Context = context;
|
|
_data = data;
|
|
Entity = entity;
|
|
Item = item;
|
|
}
|
|
|
|
public bool Update(float delta)
|
|
{
|
|
Emissivity = Context.Evaluate(_data.Emissivity, Item, Entity);
|
|
var rad = pow(Entity.Temperature, Context.GlobalData.HeatRadiationPower) * Context.GlobalData.HeatRadiationMultiplier * Emissivity;
|
|
Entity.Temperature -= rad * delta;
|
|
Entity.VisibilitySources[this] = rad;
|
|
return true;
|
|
}
|
|
} |