Some fixes made, object picking logic added
This commit is contained in:
@@ -2,42 +2,35 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using UnityEngine;
|
||||
using UnityEngine.PlayerLoop;
|
||||
using UnityEngine.XR.Content.Interaction;
|
||||
using FMOD.Studio;
|
||||
|
||||
public class AlarmTrigger : MonoBehaviour
|
||||
{
|
||||
public XRPushButton PushButton;
|
||||
public AudioSource AlarmSequence;
|
||||
public AudioSource VentilationSequence;
|
||||
|
||||
private EventInstance RoomHum;
|
||||
private EventInstance AlarmSound;
|
||||
|
||||
private FirstPersonOcclusion occlusion;
|
||||
|
||||
private bool hasAlarm = false;
|
||||
|
||||
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
|
||||
|
||||
occlusion = GetComponent<FirstPersonOcclusion>();
|
||||
occlusion = GetComponent<FirstPersonOcclusion>(); //apply occlusion
|
||||
if (occlusion != null)
|
||||
{
|
||||
occlusion.InitialiseWithInstance(RoomHum);
|
||||
occlusion.InitialiseWithInstance(AlarmSound);
|
||||
|
||||
//occlusion.InitialiseWithInstance(AlarmSound);
|
||||
}
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
RoomHum.start();
|
||||
//start playing the sound
|
||||
//start playing the Server overall sound
|
||||
//RoomHum.start();
|
||||
|
||||
if (PushButton != null)
|
||||
{
|
||||
@@ -51,8 +44,9 @@ public class AlarmTrigger : MonoBehaviour
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ServerRoomButton, PushButton.gameObject); //3d oneshot instance
|
||||
Debug.Log("Alarm button Pressed!");
|
||||
|
||||
RoomHum.setParameterByName("AlarmLogic", 0);
|
||||
hasAlarm = true;
|
||||
RoomHum.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
|
||||
|
||||
AlarmSound.start();
|
||||
|
||||
}
|
||||
void Update()
|
||||
@@ -60,13 +54,11 @@ public class AlarmTrigger : MonoBehaviour
|
||||
RoomHum.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //updating 3d attributes
|
||||
AlarmSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //updating 3d attributes
|
||||
|
||||
|
||||
VentilationSequence.Play(); // Return to normal.
|
||||
|
||||
RoomHum.start();
|
||||
AlarmSound.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
|
||||
|
||||
hasAlarm = false;
|
||||
// If alarm finished, restart hum once
|
||||
if (!AudioManager.IsPlaying(AlarmSound) && !AudioManager.IsPlaying(RoomHum))
|
||||
{
|
||||
//RoomHum.start();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,10 +96,6 @@ PrefabInstance:
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 3964068808109647281}
|
||||
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: ac65e655dd40bcd48b72b3f8ddcf45bd,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 2488785156293713400}
|
||||
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: ac65e655dd40bcd48b72b3f8ddcf45bd,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
@@ -133,129 +129,6 @@ MeshCollider:
|
||||
m_Convex: 1
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 6074735673208717538, guid: ac65e655dd40bcd48b72b3f8ddcf45bd, type: 3}
|
||||
--- !u!82 &2488785156293713400
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7023167506039495560}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 8300000, guid: 5bcb02b6a0d913d4c90781538c787b2f, type: 3}
|
||||
m_PlayOnAwake: 1
|
||||
m_Volume: 0.05
|
||||
m_Pitch: 1
|
||||
Loop: 1
|
||||
Mute: 0
|
||||
Spatialize: 0
|
||||
SpatializePostEffects: 0
|
||||
Priority: 128
|
||||
DopplerLevel: 1
|
||||
MinDistance: 1
|
||||
MaxDistance: 10
|
||||
Pan2D: 0
|
||||
rolloffMode: 2
|
||||
BypassEffects: 0
|
||||
BypassListenerEffects: 0
|
||||
BypassReverbZones: 0
|
||||
rolloffCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0.1
|
||||
value: 1
|
||||
inSlope: -10.0039835
|
||||
outSlope: -10.0039835
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.2
|
||||
value: 0.5
|
||||
inSlope: -2.5009959
|
||||
outSlope: -2.5009959
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.4
|
||||
value: 0.25
|
||||
inSlope: -0.62524897
|
||||
outSlope: -0.62524897
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.7940491
|
||||
value: 0.057891846
|
||||
inSlope: -0.27374932
|
||||
outSlope: -0.27374932
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.24773687
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0.018304445
|
||||
inSlope: -0.10003988
|
||||
outSlope: -0.10003988
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
panLevelCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
spreadCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
reverbZoneMixCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!114 &7307865721977554787
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Reference in New Issue
Block a user