using Godot;

namespace Cirno.Scripts.Components.FSM._3DPlayer;

public partial class Active : BaseState<PlayerState, CharacterBody3D>
{
    public override PlayerState StateId => PlayerState.Active;

    private CharacterBody3D _player;
    
    public override void Init(IStateMachine<PlayerState, CharacterBody3D> machine)
    {
        base.Init(machine);

        //_hud = Hud.Instance;

        //_damageReceiver.Death += () => { ChangeState(PlayerState.Dead); };

        // _damageReceiver.HealthDecreased += (value, newValue, maxValue) =>
        // {
        //     _animationProvider.Blink();
        // };

        // _damageReceiver.ShieldDecreased += (value, newValue, maxValue) =>
        // {
        //     _animationProvider.PlayShieldAnimation();
        //     
        // };

        //_damageReceiver.Init(StateMachine);

        //_damageReceiver.RefillHealth();
        //_damageReceiver.RefillShield();

        //_activationProvider.Init(MainObject);
        
        //_weaponProvider.Init(MainObject);
    }

    public override void EnterState()
    {
        base.EnterState();
        // enable sprite
        // enable crosshair
        //_crosshairProvider.Show();
        //_animationProvider.ShowSprite();
        //_damageReceiver.Enabled = true;
        //_activationProvider.Enabled = true;
        //_interactionController.Enabled = true;
        
        
    }

    public override void ExitState()
    {
        base.ExitState();
        // _animationProvider.SetAnimationSpeed(Vector2.Zero);
        // //_animationProvider.SetAnimation(Vector2.Zero);
        // _crosshairProvider.Hide();
        // _hitboxSpriteProvider.Hide();
        //
        // _damageReceiver.Enabled = false;
        // _activationProvider.Enabled = false;
        // _interactionController.Enabled = false;
    }

 
    
    public override void PhysicsProcessState(double delta)
    {
        // Reset at start of frame
        //MainObject.Velocity = Vector2.Zero;

        // Process modules
        base.PhysicsProcessState(delta);
        
        
    }

    public override void ProcessState(double delta)
    {
        base.ProcessState(delta);

        
    }

    private void PauseDeferred()
    {
        GameManager.Instance.Pause();
    }

    
}