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
|
|
|
private PlayerAnimationProvider _animationProvider;
|
2025-03-15 17:56:55 +01:00
|
|
|
|
2026-02-26 23:13:57 +01:00
|
|
|
private PlayerStorageModule _storageModule;
|
2025-03-15 17:56:55 +01:00
|
|
|
|
2025-02-28 19:59:36 +01:00
|
|
|
public override void EnterState()
|
|
|
|
|
{
|
2026-02-26 23:13:57 +01:00
|
|
|
// Resolve modules lazily to avoid method/class name conflicts with Init
|
|
|
|
|
_animationProvider ??= StateMachine.GetModule<PlayerAnimationProvider>();
|
|
|
|
|
_storageModule ??= StateMachine.GetModule<PlayerStorageModule>();
|
|
|
|
|
|
|
|
|
|
if (_storageModule != null)
|
|
|
|
|
_storageModule.FacingDirection = ((PlayerStateMachine)StateMachine).StartingDirection;
|
|
|
|
|
|
|
|
|
|
if (_animationProvider != null)
|
|
|
|
|
{
|
|
|
|
|
_animationProvider.PlayUnteleportAnimation();
|
|
|
|
|
// If you need to wait for animation end, subscribe here
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var timer = GetTree().CreateTimer(0.5f);
|
|
|
|
|
timer.Timeout += () => StateMachine.SetState(PlayerState.Active);
|
2025-02-28 19:59:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ExitState()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void PhysicsProcessState(double delta)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ProcessState(double delta)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|