Example #1
0
    IEnumerator Jump1()
    {
        if (isGrounded && canJumpAgain)
        {
            anim.SetInteger("State", 5);
            jumpPrepration = true;
            yield return(new WaitForSeconds(0.2f));

            jumpPrepration = false;
            mas.PlaySingle(jump0);
            isGrounded = false;

            if (groundState == 1)
            {
                rb.AddForce(new Vector2(0, jumpSpeed));
                canJumpAgain = false;
            }

            else if (groundState == 2)
            {
                rb.AddForce(new Vector2(0, jumpSpeed * 1.5f));//
                canJumpAgain = false;
            }
        }
    }
 public void FallSoundFX()
 {
     mas.PlaySingle(fall0);
 }