Ejemplo 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);
        }
    }
Ejemplo n.º 2
0
 private void doAttack(DamageObject d, UNITSTATE state, INPUTACTION_2 inputAction)
 {
     animator.SetAnimatorTrigger(d.animTrigger);
     playerState.SetState(state);
     lastAttack           = d;
     lastAttack.inflictor = gameObject;
     lastAttackTime       = Time.time;
     lastAttackInput      = inputAction;
     lastAttackDirection  = currentDirection;
     TurnToDir(currentDirection);
     SetVelocity(Vector3.zero);
     if (state == UNITSTATE.JUMPKICK)
     {
         return;
     }
     if (state == UNITSTATE.JUMPPUNCH)
     {
         return;                               //LETHAL FORCES - adding Jump Punch
     }
     Invoke("Ready", d.duration);
 }