Esempio n. 1
0
        private void AudioTriggerArea_OnTriggerAreaEvent(object sender, AudioTriggerAreaEventArgs e)
        {
            if (e.triggerEventType == AudioTriggerAreaEventArgs.TriggerEventType.TriggerEnter)
            {
                insideCount++;

                if (insideCount == 1 && initializationSuccesfull)
                {
                    snapshotInstance = FMODUnity.RuntimeManager.CreateInstance(snapshotPath);

                    if (snapshotInstance.isValid())
                    {
                        snapshotInstance.start();
                    }
                    else
                    {
                        Debug.LogError("Snapshot event path is invalid for Reverb Zone " + gameObject.name + ".");
                    }
                }
            }
            else
            {
                insideCount--;

                if (insideCount == 0 && initializationSuccesfull)
                {
                    if (snapshotInstance.isValid())
                    {
                        snapshotInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
                        snapshotInstance.release();
                    }
                }
            }
        }
        private void ExecuteOnExit()
        {
            AudioTriggerAreaEventArgs eventArgs = new AudioTriggerAreaEventArgs();

            eventArgs.triggerEventType = AudioTriggerAreaEventArgs.TriggerEventType.TriggerExit;
            OnTriggerAreaEvent?.Invoke(this, eventArgs);
        }
Esempio n. 3
0
 private void OnTriggerAreaEvents(object sender, AudioTriggerAreaEventArgs eventArgs)
 {
     if (eventArgs.triggerEventType == AudioTriggerAreaEventArgs.TriggerEventType.TriggerEnter)
     {
         InitialTriggerBranch(TriggerOn.OnTriggerEnter);
     }
     else
     {
         InitialTriggerBranch(TriggerOn.OnTriggerExit);
     }
 }
        private void AudioTriggerArea_OnTriggerAreaEvent(object sender, AudioTriggerAreaEventArgs e)
        {
            if (!initializationSuccesfull)
            {
                return;
            }

            if (e.triggerEventType == AudioTriggerAreaEventArgs.TriggerEventType.TriggerEnter)
            {
                insideCounter++;

                if (insideCounter == 1)
                {
                    if (!ambienceStarted)
                    {
                        StartAmbience();
                    }

                    InsideStatus = 1;

                    if (baseAmbienceInstance.isValid())
                    {
                        baseAmbienceInstance.setVolume(InsideStatus);
                        UpdateInsideStatusForSpots();
                    }
                }
            }
            else
            {
                insideCounter--;

                if (insideCounter == 0)
                {
                    InsideStatus = 0;

                    if (baseAmbienceInstance.isValid())
                    {
                        baseAmbienceInstance.setVolume(InsideStatus);
                        UpdateInsideStatusForSpots();
                    }

                    if (enteredSpotAmbienceAreas.Count < 1)
                    {
                        StopAmbience(FMOD.Studio.STOP_MODE.IMMEDIATE);
                    }
                }
            }
        }
        public void OnPlayerEnterAndExit(object sender, AudioTriggerAreaEventArgs eventArgs)
        {
            if (eventArgs.triggerEventType == AudioTriggerAreaEventArgs.TriggerEventType.TriggerEnter)
            {
                if (spatialAudioManager != null)
                {
                    spatialAudioManager.AddCurrentPlayerRoom(this);
                }
            }

            if (eventArgs.triggerEventType == AudioTriggerAreaEventArgs.TriggerEventType.TriggerExit)
            {
                if (spatialAudioManager != null)
                {
                    spatialAudioManager.RemoveCurrentPlayerRoom(this);
                }
            }
        }