r2mods/ilspy_dump/ror2_csproj/EntityStates.QuestVolatileB.../Monitor.cs

33 lines
783 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine.Networking;
namespace EntityStates.QuestVolatileBattery;
public class Monitor : QuestVolatileBatteryBaseState
{
private float previousHealthFraction;
private static readonly float healthFractionDetonationThreshold = 0.5f;
public override void FixedUpdate()
{
base.FixedUpdate();
if (NetworkServer.active)
{
FixedUpdateServer();
}
}
private void FixedUpdateServer()
{
if ((bool)base.attachedHealthComponent)
{
float combinedHealthFraction = base.attachedHealthComponent.combinedHealthFraction;
if (combinedHealthFraction <= healthFractionDetonationThreshold && healthFractionDetonationThreshold < previousHealthFraction)
{
outer.SetNextState(new CountDown());
}
previousHealthFraction = combinedHealthFraction;
}
}
}