Beispiel #1
0
        void Start()
        {
            // Create
            RESULT result = RESULT.OK;

            result = RuntimeManager.LowlevelSystem.createReverb3D(out reverb);

            if (result != RESULT.OK)
            {
                UnityEngine.Debug.LogWarning("FMOD Extensions: Could not create 3D Reverb. " + result);
                return;
            }

            // Get the reverb's properties (preset and position)
            properties = ExtensionsUtils.ExtensionReverbToFMODReverb(preset);
            reverb.setProperties(ref properties);
            VECTOR pos = RuntimeUtils.ToFMODVector(transform.position);

            // Set position, min and max distances
            result = reverb.set3DAttributes(ref pos, minDistance, maxDistance);

            if (result != RESULT.OK)
            {
                UnityEngine.Debug.LogError("FMOD Extensions: Could not set 3D attributes to the 3D reverb " + result, this);
                return;
            }

            UnityEngine.Debug.Log("FMOD Extensions: Created 3D Reverb");
        }
        void Play()
        {
            if (!sound.hasHandle())
            {
                Load();
            }

            ExtensionsManager.PlaySound(sound, channelGroup, out channel, true);

            if (Position != Positioning._2D)
            {
                VECTOR pos  = RuntimeUtils.ToFMODVector(transform.position);
                VECTOR zero = new VECTOR();
                channel.set3DAttributes(ref pos, ref zero, ref zero);
                ExtensionsManager.AttachToGameObject(channel, transform, GetComponent <Rigidbody>());
                channel.set3DMinMaxDistance(MinDistance, MaxDistance);
            }

            if (!UseReverb)
            {
                channel.setReverbProperties(0, 0f);
            }

            channel.setVolume(Volume);
            channel.setPaused(false);
        }