From aa5c673300c0c97db6101b6fda5204b548d0bdf4 Mon Sep 17 00:00:00 2001 From: BuyMyMojo Date: Sat, 4 Mar 2023 09:29:20 +1100 Subject: [PATCH] Add burning warning sound to stove --- .erp | 2 +- Assets/Scripts/SoundManager.cs | 5 ++++ Assets/Scripts/StoveCounterSound.cs | 33 ------------------------ Assets/Scripts/StoveCounterSound.cs.meta | 11 -------- 4 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 Assets/Scripts/StoveCounterSound.cs delete mode 100644 Assets/Scripts/StoveCounterSound.cs.meta diff --git a/.erp b/.erp index 86ac332..9eb8ec4 100644 --- a/.erp +++ b/.erp @@ -5,7 +5,7 @@ false false true - 1677889305 + 1677890269 2115309888051293429 false \ No newline at end of file diff --git a/Assets/Scripts/SoundManager.cs b/Assets/Scripts/SoundManager.cs index 2d3e2ec..fff6e17 100644 --- a/Assets/Scripts/SoundManager.cs +++ b/Assets/Scripts/SoundManager.cs @@ -85,6 +85,11 @@ public class SoundManager : MonoBehaviour PlaySound(audioClipsRefsSO.warning, Vector3.zero); } + public void PlayWarningSound(Vector3 position) + { + PlaySound(audioClipsRefsSO.warning, position); + } + public void ChangeVolume() { volume += .1f; diff --git a/Assets/Scripts/StoveCounterSound.cs b/Assets/Scripts/StoveCounterSound.cs deleted file mode 100644 index 1df229b..0000000 --- a/Assets/Scripts/StoveCounterSound.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class StoveCounterSound : MonoBehaviour -{ - - [SerializeField] private StoveCounter stoveCounter; - private AudioSource audioSource; - - private void Awake() - { - audioSource = GetComponent(); - } - - private void Start() - { - stoveCounter.OnStateChanged += StoveCounter_OnStateChanged; - } - - private void StoveCounter_OnStateChanged(object sender, StoveCounter.OnStateChangedEventArgs e) - { - bool playSound = e.state == StoveCounter.State.Frying || e.state == StoveCounter.State.Fried; - - if (playSound) - { - audioSource.Play(); - } else - { - audioSource.Pause(); - } - } -} diff --git a/Assets/Scripts/StoveCounterSound.cs.meta b/Assets/Scripts/StoveCounterSound.cs.meta deleted file mode 100644 index d625e23..0000000 --- a/Assets/Scripts/StoveCounterSound.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a58f05adbbecd024eacd08f86e3c175c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: