Restore the stable legacy Unity project

This commit is contained in:
Meta Vens 2026-08-10 14:57:50 +01:00
commit 7006a6b0dd
2070 changed files with 180490 additions and 169303 deletions

View file

@ -1,32 +1,49 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* 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;
using Newtonsoft.Json;
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(10)]
public class HeatData : BehaviorData
{
[Inspectable, JsonProperty("heat"), Key(1), RuntimeInspectable]
public PerformanceStat Heat = new PerformanceStat();
[Inspectable, JsonProperty("perSecond"), 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 readonly PerformanceStat _heat;
private readonly bool _perSecond;
private HeatData _data;
public Heat(RuntimeBehaviorDefinition definition, EquippedItem item) : base(definition, item)
public Heat(HeatData data, EquippedItem item) : base(data, item)
{
_heat = definition.PerformanceStat(1, new PerformanceStat());
_perSecond = definition.Bool(2);
RegisterPerformanceStat(nameof(Heat), _heat);
_data = data;
}
public Heat(RuntimeBehaviorDefinition definition, ConsumableItemEffect item) : base(definition, item)
public Heat(HeatData data, ConsumableItemEffect item) : base(data, item)
{
_heat = definition.PerformanceStat(1, new PerformanceStat());
_perSecond = definition.Bool(2);
RegisterPerformanceStat(nameof(Heat), _heat);
_data = data;
}
public override bool Execute(float dt)
{
AddHeat(Evaluate(_heat) * (_perSecond ? dt : 1));
AddHeat(Evaluate(_data.Heat) * (_data.PerSecond ? dt : 1));
return true;
}
}
}