using System;
using System.Threading.Tasks;
using Godot;

namespace Cirno.Scripts.Components.FSM.Player;

public partial class Init : PlayerStateBase
{
    public override PlayerState StateId => PlayerState.Init;
    
    [Export]
    private PlayerAnimationProvider _animationProvider;
    
    [Export] private PlayerStorageModule _storageModule;
    
    public override void EnterState()
    {
        _storageModule.FacingDirection = ((PlayerStateMachine)StateMachine).StartingDirection;
        _animationProvider.PlayUnteleportAnimation();
        _ = AutoSwitchToStart();
    }

    public override void ExitState()
    {

    }

    public override void PhysicsProcessState(double delta)
    {

    }

    public override void ProcessState(double delta)
    {

    }

    private async Task AutoSwitchToStart()
    {
        await Task.Delay(500);
        StateMachine.SetState(PlayerState.Active);
    }
}
