Aetheria/Assets/Scripts/ServerShared/Behaviors/Heat.cs
2026-06-13 04:56:50 +01:00

47 lines
No EOL
1.1 KiB
C#

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject, Order(10)]
public class HeatData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
public PerformanceStat Heat = new PerformanceStat();
[Inspectable, Key(2)]
public bool PerSecond;
public override Behavior CreateInstance(EquippedItem item)
{
return new Heat(this, item);
}
public override Behavior CreateInstance(ConsumableItemEffect item)
{
return new Heat(this, item);
}
}
public class Heat : Behavior
{
private HeatData _data;
public Heat(HeatData data, EquippedItem item) : base(data, item)
{
_data = data;
}
public Heat(HeatData data, ConsumableItemEffect item) : base(data, item)
{
_data = data;
}
public override bool Execute(float dt)
{
AddHeat(Evaluate(_data.Heat) * (_data.PerSecond ? dt : 1));
return true;
}
}