Esempio n. 1
0
    private void Jump()
    {
        if (!canMove)
        {
            return;
        }
        if (hasJumped)
        {
            return;
        }
        if (coyoteTimeCounter > 0)
        {
            anim.TriggerAnim("Jump");
            InstantiateDust();
            am.PlaySound("Jump");
            hasJumped = true;

            if (!ps.isKnockedback)
            {
                rb.gravityScale = 1.5f;
                rb.velocity     = new Vector2(rb.velocity.x, jumpForce);
            }
            else
            {
                rb.velocity  = new Vector2(rb.velocity.x, 0f);
                rb.velocity += Vector2.up * jumpForce;
            }
        }
    }
Esempio n. 2
0
    IEnumerator Pause()
    {
        am.PlaySound("Player Hit");
        anim.TriggerAnim("Hurt");

        Time.timeScale = 0.01f;
        yield return(new WaitForSecondsRealtime(0.15f));

        Time.timeScale = 1f;
        yield return(new WaitForSeconds(0.35f));
    }