cirnogodot/Scripts/Components/FSM/Elevator/Top.cs
2025-03-06 10:27:06 +01:00

46 lines
No EOL
1.2 KiB
C#

using Cirno.Scripts.Enums;
using Godot;
namespace Cirno.Scripts.Components.FSM.Elevator;
public partial class Top : BaseState<ElevatorState, ElevatorProxy>
{
public override ElevatorState StateId => ElevatorState.Top;
public override void EnterState()
{
MainObject.SetPosition(MainObject.ElevatorPath.Curve.GetPointPosition(0));
MainObject.Activated += ElevatorActivated;
}
private void ElevatorActivated(ActivationType type)
{
switch (type)
{
case ActivationType.Use:
case ActivationType.Toggle:
MoveToBottom();
break;
case ActivationType.Enable:
break;
case ActivationType.Disable:
break;
case ActivationType.Destroy:
break;
case ActivationType.Open:
break;
case ActivationType.Close:
break;
}
}
private void MoveToBottom()
{
StateMachine.SetState(ElevatorState.Descending);
}
public override void ExitState()
{
MainObject.Activated -= ElevatorActivated;
}
}