cirnogodot/Scripts/Components/FSM/Elevator/Top.cs

51 lines
1.3 KiB
C#
Raw Normal View History

2025-03-06 10:27:06 +01:00
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;
2025-03-11 15:03:44 +01:00
// Disable top body
MainObject.TopBody.Disabled = true;
2025-03-06 10:27:06 +01:00
}
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;
2025-03-11 15:03:44 +01:00
// Enable top body
MainObject.TopBody.Disabled = false;
2025-03-06 10:27:06 +01:00
}
}