r2mods/ilspy_dump/ror2_csproj/EntityStates.Toolbot/StartToolbotStanceSwap.cs

33 lines
802 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using System.Linq;
using RoR2;
namespace EntityStates.Toolbot;
public class StartToolbotStanceSwap : BaseState
{
private EntityStateMachine stanceStateMachine;
public override void OnEnter()
{
base.OnEnter();
if (base.isAuthority)
{
stanceStateMachine = base.gameObject.GetComponents<EntityStateMachine>().FirstOrDefault((EntityStateMachine c) => c.customName == "Stance");
if (stanceStateMachine?.state is ToolbotStanceBase toolbotStanceBase && toolbotStanceBase.swapStateType != null)
{
stanceStateMachine.SetNextState(new ToolbotStanceSwap
{
previousStanceState = toolbotStanceBase.GetType(),
nextStanceState = toolbotStanceBase.swapStateType
});
}
}
}
public override void FixedUpdate()
{
base.FixedUpdate();
outer.SetNextStateToMain();
}
}