void CheckToDash()
 {
     if (Time.time > cdDashEnd && dashing)
     {
         mgJump.SetFloating(false);
         mgMovement.ResetSpeed();
         dashing = false;
         return;
     }
     if (hasDashed)
     {
         return;
     }
     if (Stunned() || Time.time < cdDash)
     {
         return;
     }
     if (Controls.curControlType == Controls.controlType.KEYBOARD)
     {
         if (Input.GetKeyDown(Controls.player_dodge))
         {
             Dash();
         }
     }
     else
     {
         if (Input.GetAxisRaw("ControllerTrigger") < 0)
         {
             if (!triggerAxisDown)
             {
                 Dash();
                 triggerAxisDown = true;
             }
         }
         else if (Input.GetAxis("ControllerTrigger") == 0)
         {
             triggerAxisDown = false;
         }
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (state == State.RECOVERY && !hasHit)
        {
            CheckAttack();
        }

        if (Time.time < cdWait)
        {
            return;
        }
        if (state == State.IDLE)
        {
            if (holdAttack)
            {
                SetState(State.STARTUP);
            }
        }
        else if (state == State.STARTUP)
        {
            damage = 1;
            cdWait = Time.time;
            SetState(State.ATTACKING);
        }
        else if (state == State.ATTACKING)
        {
            animator.SetTrigger(attackAnim);
            hasHit = false;
            attack.gameObject.SetActive(true);
            SetState(State.RECOVERY);
            cdWait = Time.time + cdbAttack;
        }
        else if (state == State.RECOVERY)
        {
            animator.SetTrigger("idle");

            if (mgJump.IsFloating())
            {
                mgJump.SetFloating(false);
            }
            hasHit     = false;
            holdAttack = false;
            if (attack != null)
            {
                attack.gameObject.SetActive(false);
            }
            attack = null;
            SetState(State.IDLE);
            cdWait = Time.time + cdbRecovery;
        }
    }