private void jump(float initialVelocity)
 {
     velocity.y = initialVelocity;
     animation.animate(PlayerState.AnimationState.jump);
     state.airState = PlayerState.AirState.jump;
     audio.Play("jump");
 }
Пример #2
0
    public void TakeDamage()
    {
        if (deathInt == 1)
        {
            currentHealth -= 40;

            if (currentHealth <= 0)
            {
                audio.Play("die");
            }
            else
            {
                audio.Play("hurt");
            }

            animator.TakeDamage();
            runInt       = 0;
            currentSpeed = 0;

            Invoke("ReturnSpeed", 0.3f);


            if (currentHealth <= 0)
            {
                Die();
            }
        }
    }
Пример #3
0
    private void PlaySound(string s1, string s2)
    {
        int random = UnityEngine.Random.Range(1, 3);

        if (random == 1)
        {
            audio.Play(s1);
        }
        else
        {
            audio.Play(s2);
        }
    }
Пример #4
0
    void JumpSound()
    {
        if (isJumping == true)
        {
            jumpInt = 1;
        }

        if (isJumping == false && jumpInt == 1)
        {
            audio.Play("FallSound");
            jumpInt = 0;
        }
    }