cirnogodot/Scripts/Components/FSM/Player/Init.cs

43 lines
916 B
C#
Raw Normal View History

2025-02-28 19:59:36 +01:00
using System;
2025-03-03 10:58:20 +01:00
using System.Threading.Tasks;
2025-02-28 19:59:36 +01:00
using Godot;
namespace Cirno.Scripts.Components.FSM.Player;
2025-03-05 10:55:14 +01:00
public partial class Init : PlayerStateBase
2025-02-28 19:59:36 +01:00
{
2025-03-05 10:55:14 +01:00
public override PlayerState StateId => PlayerState.Init;
2025-03-03 10:58:20 +01:00
[Export]
private PlayerAnimationProvider _animationProvider;
2025-03-15 17:56:55 +01:00
[Export] private PlayerStorageModule _storageModule;
2025-02-28 19:59:36 +01:00
public override void EnterState()
{
2025-03-15 17:56:55 +01:00
_storageModule.FacingDirection = ((PlayerStateMachine)StateMachine).StartingDirection;
2025-03-03 10:58:20 +01:00
_animationProvider.PlayUnteleportAnimation();
_ = AutoSwitchToStart();
2025-02-28 19:59:36 +01:00
}
public override void ExitState()
{
}
public override void PhysicsProcessState(double delta)
{
}
public override void ProcessState(double delta)
{
}
2025-03-03 10:58:20 +01:00
private async Task AutoSwitchToStart()
{
await Task.Delay(500);
2025-03-05 10:55:14 +01:00
StateMachine.SetState(PlayerState.Active);
2025-03-03 10:58:20 +01:00
}
2025-02-28 19:59:36 +01:00
}