cirnogodot/Scripts/Components/FSM/Elevator/Bottom.cs
2025-03-11 15:03:44 +01:00

51 lines
No EOL
1.2 KiB
C#

using System;
using Cirno.Scripts.Enums;
using Godot;
namespace Cirno.Scripts.Components.FSM.Elevator;
public partial class Bottom : BaseState<ElevatorState, ElevatorProxy>
{
public override ElevatorState StateId => ElevatorState.Bottom;
public override void EnterState()
{
MainObject.SetPosition(MainObject.Bottom);
MainObject.Activated += ElevatorActivated;
// Enable top body
MainObject.TopBody.Disabled = false;
}
private void ElevatorActivated(ActivationType type)
{
switch (type)
{
case ActivationType.Use:
case ActivationType.Toggle:
MoveToTop();
break;
case ActivationType.Enable:
break;
case ActivationType.Disable:
break;
case ActivationType.Destroy:
break;
case ActivationType.Open:
break;
case ActivationType.Close:
break;
}
}
private void MoveToTop()
{
StateMachine.SetState(ElevatorState.Ascending);
}
public override void ExitState()
{
MainObject.Activated -= ElevatorActivated;
}
}