Add burning warning sound to stove
This commit is contained in:
parent
56893af14d
commit
aa5c673300
4 changed files with 6 additions and 45 deletions
2
.erp
2
.erp
|
@ -5,7 +5,7 @@
|
|||
<resetOnSceneChange>false</resetOnSceneChange>
|
||||
<debugMode>false</debugMode>
|
||||
<EditorClosed>true</EditorClosed>
|
||||
<LastTimestamp>1677889305</LastTimestamp>
|
||||
<LastTimestamp>1677890269</LastTimestamp>
|
||||
<LastSessionID>2115309888051293429</LastSessionID>
|
||||
<Errored>false</Errored>
|
||||
</ERPSettings>
|
|
@ -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;
|
||||
|
|
|
@ -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<AudioSource>();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a58f05adbbecd024eacd08f86e3c175c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in a new issue