Ejemplo n.º 1
0
    void ManageAudio()
    {
        if (player.state != PlayerMasterController.PlayerStates.DEAD)
        {
            bool moving = player.isMoving();
            if (moving && !wasMoving)
            {
                stepCount = stepSilence;
            }

            if (player.onSurface() && moving)
            {
                if (stepCount >= stepSilence)
                {
                    sc.Play((int)PlayerSounds.WALK_STEP);
                    stepCount = 0f;
                }
                stepCount += Time.deltaTime;
            }

            wasMoving = moving;
        }
        else
        {
            if (alive)
            {
                sc.Play((int)PlayerSounds.DEATH);
                alive = false;
            }
        }
    }
Ejemplo n.º 2
0
 void ManageJump()
 {
     if (Input.GetButtonDown("Jump"))
     {
         if (player.onSurface())
         {
             _rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
             player.jumped();
             //anim.SetBool("Jump", true);
             //anim.speed = velocidad_saltar;
         }
     }
 }