Exemple #1
0
    // Update is called once per frame (used for non-physics and detecting single presses of buttons)
    void Update()
    {
        if (!playerData.IsDashing() && !playerData.isStunned())          //only bother checking for jumps if player isn't in a dash or stunned
        {
            //jump
            if (Input.GetButtonDown(keyBind.JumpButton()) && playerData.CanJump())
            {
                anim.SetTrigger("Jump");                 //calls vertical jump in animation
            }

            anim.SetFloat("MoveSpeed", rigidbody2D.velocity.x);
            anim.SetFloat("VertSpeed", rigidbody2D.velocity.y);
        }

        //dash right
        if (Input.GetButtonDown(keyBind.RDashButton()) && playerData.CanDash() && !wallRight)
        {
            DashRight();
        }

        //dash left
        if (Input.GetButtonDown(keyBind.LDashButton()) && playerData.CanDash() && !wallLeft)
        {
            DashLeft();
        }
    }