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,30 +1,47 @@
/* 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), RuntimeInspectable]
public class VisibilityData : BehaviorData
{
[Inspectable, JsonProperty("visibility"), Key(1), RuntimeInspectable]
public PerformanceStat Visibility = new PerformanceStat();
[Inspectable, JsonProperty("visibilityDecay"), Key(2)]
public PerformanceStat VisibilityDecay = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)
{
return new Visibility(this, item);
}
public override Behavior CreateInstance(ConsumableItemEffect item)
{
return new Visibility(this, item);
}
}
public class Visibility : Behavior
{
private readonly PerformanceStat _visibility;
private VisibilityData _data;
public Visibility(RuntimeBehaviorDefinition definition, EquippedItem item) : base(definition, item)
public Visibility(VisibilityData data, EquippedItem item) : base(data, item)
{
_visibility = definition.PerformanceStat(1, new PerformanceStat());
RegisterPerformanceStat(nameof(Visibility), _visibility);
RegisterPerformanceStat("VisibilityDecay", definition.PerformanceStat(2, new PerformanceStat()));
_data = data;
}
public Visibility(RuntimeBehaviorDefinition definition, ConsumableItemEffect item) : base(definition, item)
public Visibility(VisibilityData data, ConsumableItemEffect item) : base(data, item)
{
_visibility = definition.PerformanceStat(1, new PerformanceStat());
RegisterPerformanceStat(nameof(Visibility), _visibility);
RegisterPerformanceStat("VisibilityDecay", definition.PerformanceStat(2, new PerformanceStat()));
_data = data;
}
public override bool Execute(float dt)
{
Entity.VisibilitySources[this] = Evaluate(_visibility);
Entity.VisibilitySources[this] = Evaluate(_data.Visibility);
return true;
}
}
}