Deleted MetaXR, fire alarm is still in progress
This commit is contained in:
@@ -14,7 +14,6 @@ public class AlarmTrigger : MonoBehaviour
|
||||
|
||||
private EventInstance RoomHum;
|
||||
private EventInstance AlarmSound;
|
||||
private EventInstance ServerButton;
|
||||
|
||||
private FirstPersonOcclusion occlusion;
|
||||
|
||||
@@ -23,10 +22,11 @@ public class AlarmTrigger : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
RoomHum = AudioManager.Instance.CreateInstance(FMODEvents.Instance.ServerRoomHumming); //initialise the instance
|
||||
RoomHum.setParameterByName("AlarmLogic", 1);
|
||||
RoomHum.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //make it 3d
|
||||
|
||||
AlarmSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.ServerRoomAlarm); //initialise the instance
|
||||
AlarmSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //make it 3d
|
||||
//AlarmSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.ServerRoomAlarm); //initialise the instance
|
||||
//AlarmSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //make it 3d
|
||||
|
||||
occlusion = GetComponent<FirstPersonOcclusion>();
|
||||
if (occlusion != null)
|
||||
@@ -48,27 +48,24 @@ public class AlarmTrigger : MonoBehaviour
|
||||
|
||||
void OnButtonPressed()
|
||||
{
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ServerRoomButton, gameObject); //3d oneshot instance
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ServerRoomButton, PushButton.gameObject); //3d oneshot instance
|
||||
Debug.Log("Alarm button Pressed!");
|
||||
|
||||
if (!AudioManager.IsPlaying(AlarmSound)){ //if alarm isn't already triggered.
|
||||
VentilationSequence.Stop();
|
||||
AlarmSequence.Play();
|
||||
RoomHum.setParameterByName("AlarmLogic", 0);
|
||||
hasAlarm = true;
|
||||
|
||||
AlarmSound.start(); //start playing the sound
|
||||
RoomHum.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); //stop playing the sound
|
||||
|
||||
|
||||
hasAlarm = true;
|
||||
}
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if(hasAlarm && !AudioManager.IsPlaying(AlarmSound)) // If alarm state has ended.
|
||||
RoomHum.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //updating 3d attributes
|
||||
AlarmSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //updating 3d attributes
|
||||
|
||||
if (hasAlarm && !AudioManager.IsPlaying(AlarmSound)) // If alarm state has ended.
|
||||
{
|
||||
VentilationSequence.Play(); // Return to normal.
|
||||
|
||||
RoomHum.start();
|
||||
AlarmSound.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
|
||||
|
||||
hasAlarm = false;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -232,6 +232,9 @@ public class AudioManager : MonoBehaviour
|
||||
RuntimeManager.StudioSystem.setParameterByName(parameterName, value);
|
||||
}
|
||||
|
||||
//=====//
|
||||
//Some functions for initialising music, perhaps there will be a need in the future...
|
||||
//=====//
|
||||
public void InitializeMusic(EventReference musicEventReference)
|
||||
{
|
||||
if (musicEventReference.Guid == nullGuid)
|
||||
@@ -262,11 +265,6 @@ public class AudioManager : MonoBehaviour
|
||||
return position;
|
||||
}
|
||||
|
||||
public void StopSFX()
|
||||
{
|
||||
sfxBus.stopAllEvents(FMOD.Studio.STOP_MODE.IMMEDIATE);
|
||||
}
|
||||
|
||||
public void FadeOutMusic()
|
||||
{
|
||||
musicEventInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
|
||||
@@ -280,6 +278,14 @@ public class AudioManager : MonoBehaviour
|
||||
return state != PLAYBACK_STATE.STOPPED;
|
||||
}
|
||||
|
||||
//=====//
|
||||
//=====//
|
||||
|
||||
public void StopSFX()
|
||||
{
|
||||
sfxBus.stopAllEvents(FMOD.Studio.STOP_MODE.IMMEDIATE);
|
||||
}
|
||||
|
||||
public static bool IsPlaying(EventInstance instance)
|
||||
{
|
||||
instance.getPlaybackState(out PLAYBACK_STATE state);
|
||||
|
||||
Reference in New Issue
Block a user