public void Dash() { var direction = GetComponent <PlayerMovement>().looking; if (canDash) { // Set users in dashing state/invincibility state for a frame or two canDash = false; StartCoroutine(ToggleIsDashingBool()); switch (direction) { default: throw new System.Exception("invalid dash direction provided"); case Looking.Up: rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y + dashSpeed); playerAnim.Play("Human_Dash_Up"); shaker.CombatShaker("Up"); dashCoolDown = Time.time; break; case Looking.Down: rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y - dashSpeed); playerAnim.Play("Human_Dash_Down"); shaker.CombatShaker("Down"); dashCoolDown = Time.time; break; case Looking.Left: rb.velocity = new Vector2(rb.velocity.x - dashSpeed, rb.velocity.y); playerAnim.Play("Human_Dash_Left"); shaker.CombatShaker("Left"); dashCoolDown = Time.time; break; case Looking.Right: rb.velocity = new Vector2(rb.velocity.x + dashSpeed, rb.velocity.y); playerAnim.Play("Human_Dash_Right"); shaker.CombatShaker("Right"); dashCoolDown = Time.time; break; } CreateDust(); gameManager.HostStamina--; } }