// IEnumerator stepSoundCoroutine() // { // playingStepSound = true; // // if(switchStep == true) // { // leftStepSoundRandomizer.Randomize(); // leftStepSound.Play(); // } // else // { // rightStepSoundRandomizer.Randomize(); // rightStepSound.Play(); // } // // switchStep = !switchStep; // yield return new WaitForSeconds(stepFrequency/playerMove.actualSpeed); // playingStepSound = false; // } IEnumerator jumpSoundCoroutine() { playingJumpSound = true; jumpSoundRandomizer.Randomize(); jumpSound.Play(); yield return(new WaitForSeconds(0.1f)); playingJumpSound = false; }
void Update() { // if(playerMove.moving == true && playingStepSound == false) // { // // } if (handMovementLeft.playStepSound == true) { handMovementLeft.playStepSound = false; leftStepSoundRandomizer.Randomize(); leftStepSound.Play(); } if (handMovementRight.playStepSound == true) { handMovementRight.playStepSound = false; rightStepSoundRandomizer.Randomize(); rightStepSound.Play(); } if (playerMove.jumping == true && playingJumpSound == false) { StartCoroutine(jumpSoundCoroutine()); } if (playerMove.checkGround.grounded == true && playingLandSound == false) { playingLandSound = true; landSoundRandomizer.Randomize(); landSound.Play(); } if (playerMove.checkGround.grounded == false) { playingLandSound = false; } float v = Mathf.Clamp(rgdBody.velocity.magnitude, 0.0f, 10.0f); movingSound.volume = movingSoundVolume * v; movingSound.pitch = movingSoundPitch * v; }
public void PlayHitSound(Vector3 p) { hitSoundRandomizer.Randomize(); hitSound.transform.position = p; hitSound.Play(); }