/// <summary> /// Update is called every frame, if the MonoBehaviour is enabled. /// </summary> void Update() { if (GameManager.instance.inGamePlay && !GameManager.instance.isPaused) { // set the weapon animation. // SetAnimation(); // calculate point in the screen where the bullet is going to be shot at. UpdateShootingOriginPosition(); // check if weapon has cooled. CheckHeatedStatus(); // check if the user is clicking the left button mouse to shoot. if (Input.GetMouseButtonDown(0) && !plasmaGunData.heated && !player.isRunning) { Shoot(); } // display no ammo sound if the users tries to shoot and the plasma gun is heated. if (Input.GetMouseButtonDown(0) && plasmaGunData.heated) { // display no ammo sound. _audio.PlaySound(1); } if (Input.GetMouseButtonUp(0)) { _framesHolding = 0; } } else { // stop heated sound if game gets paused. if (_heatedRoutine != null) { heatedAudio.StopAudio(); _heatedRoutine = null; } } }
/// <summary> /// Disable audio for player. /// </summary> public void DisableAudio() { _audio.StopAudio(); }
/// <summary> /// Stop level song. /// </summary> public void StopLevelSong() { audio.StopAudio(); }