using UnityEngine;

public class PlayerAnimator 
{
    private readonly Animator _animator;
    private readonly int _runningHash = Animator.StringToHash("Run");
    private readonly int _deadHash = Animator.StringToHash("Dead");
    private readonly int _jumpHash = Animator.StringToHash("Jump");
    private readonly int _slideHash = Animator.StringToHash("Slide");
    private readonly int _idleHash = Animator.StringToHash("Idle");

    public PlayerAnimator(Animator animator)
    {
        if (animator)
            this._animator = animator;
    }
    public void SetRunState(bool isRunning)
    {
        _animator?.SetBool(_runningHash, isRunning);
    }
    public void SetJumpState(bool isJumping)
    {
        _animator?.SetBool(_jumpHash, isJumping);
    }
    public void SetDeadState(bool isDead)
    {
        _animator?.SetBool(_deadHash, isDead);
    }
    public void SetSlideState(bool isSliding)
    {
        _animator?.SetBool(_slideHash, isSliding);
    }
    public void SetIdleState(bool isIdle)
    {
        if(_animator){}
        _animator?.SetBool(_idleHash, isIdle);
    }
}
