Esempio n. 1
0
    //jump
    IEnumerator doJump()
    {
        //set jump state
        jumpInProgress = true;
        playerState.SetState(UNITSTATE.JUMPING);

        //play animation
        animator.SetAnimatorBool("JumpInProgress", true);
        animator.SetAnimatorTrigger("JumpUp");
        animator.ShowDustEffectJump();

        //play sfx
        if (jumpUpVoice != "")
        {
            GlobalAudioPlayer.PlaySFXAtPosition(jumpUpVoice, transform.position);
        }

        //set state
        yield return(new WaitForFixedUpdate());

        //start jump
        while (isGrounded)
        {
            SetVelocity(Vector3.up * JumpForce);
            yield return(new WaitForFixedUpdate());
        }

        //continue until we hit the ground
        while (!isGrounded)
        {
            yield return(new WaitForFixedUpdate());
        }

        //land
        playerState.SetState(UNITSTATE.LAND);
        SetVelocity(Vector3.zero);

        animator.SetAnimatorFloat("MovementSpeed", 0f);
        animator.SetAnimatorBool("JumpInProgress", false);
        animator.SetAnimatorBool("JumpKickActive", false);
        animator.SetAnimatorBool("JumpPunchActive", false); //LETHAL FORCES - Adding Jump Punch
        animator.ShowDustEffectLand();

        //sfx
        GlobalAudioPlayer.PlaySFX("FootStep");
        if (jumpLandVoice != "")
        {
            GlobalAudioPlayer.PlaySFXAtPosition(jumpLandVoice, transform.position);
        }

        jumpInProgress = false;

        if (playerState.currentState == UNITSTATE.LAND)
        {
            yield return(new WaitForSeconds(landRecoveryTime));

            setPlayerState(UNITSTATE.IDLE);
        }
    }
Esempio n. 2
0
    //perform a jump
    void Jump()
    {
        playerState.SetState(UNITSTATE.JUMPING);
        JumpNextFixedUpdate = false;
        jumpInProgress      = true;
        rb.velocity         = Vector3.up * JumpForce;

        //play animation
        animator.SetAnimatorBool("JumpInProgress", true);
        animator.SetAnimatorTrigger("JumpUp");
        animator.ShowDustEffectJump();

        //play sfx
        if (jumpUpVoice != "")
        {
            GlobalAudioPlayer.PlaySFXAtPosition(jumpUpVoice, transform.position);
        }
    }