2026-06-13 04:56:50 +01:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2020-12-22 03:13:43 +00:00
|
|
|
* 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;
|
2020-05-12 01:42:13 +01:00
|
|
|
using System.Linq;
|
2021-04-18 05:13:20 +01:00
|
|
|
public class Visibility : Behavior
|
2020-05-12 01:42:13 +01:00
|
|
|
{
|
2026-06-15 17:48:36 +01:00
|
|
|
private readonly PerformanceStat _visibility;
|
2020-05-12 01:42:13 +01:00
|
|
|
|
2026-06-15 19:06:13 +01:00
|
|
|
public Visibility(RuntimeBehaviorDefinition definition, EquippedItem item) : base(definition, item)
|
2021-04-18 05:13:20 +01:00
|
|
|
{
|
2026-06-15 19:06:13 +01:00
|
|
|
_visibility = definition.PerformanceStat(1, new PerformanceStat());
|
|
|
|
|
RegisterPerformanceStat(nameof(Visibility), _visibility);
|
|
|
|
|
RegisterPerformanceStat("VisibilityDecay", definition.PerformanceStat(2, new PerformanceStat()));
|
2021-04-18 05:13:20 +01:00
|
|
|
}
|
2026-06-15 19:06:13 +01:00
|
|
|
|
|
|
|
|
public Visibility(RuntimeBehaviorDefinition definition, ConsumableItemEffect item) : base(definition, item)
|
2020-05-12 01:42:13 +01:00
|
|
|
{
|
2026-06-15 19:06:13 +01:00
|
|
|
_visibility = definition.PerformanceStat(1, new PerformanceStat());
|
|
|
|
|
RegisterPerformanceStat(nameof(Visibility), _visibility);
|
|
|
|
|
RegisterPerformanceStat("VisibilityDecay", definition.PerformanceStat(2, new PerformanceStat()));
|
2020-05-12 01:42:13 +01:00
|
|
|
}
|
|
|
|
|
|
2021-04-18 05:13:20 +01:00
|
|
|
public override bool Execute(float dt)
|
2020-05-12 01:42:13 +01:00
|
|
|
{
|
2026-06-15 17:48:36 +01:00
|
|
|
Entity.VisibilitySources[this] = Evaluate(_visibility);
|
2020-05-12 01:42:13 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
2026-06-15 17:48:36 +01:00
|
|
|
}
|