Exemple #1
0
    private void OnDisable()
    {
        for (var i = 0; i < roomAwareObjectsEntered.Count; ++i)
        {
            roomAwareObjectsEntered[i].ExitedRoom(this);
            AkRoomAwareManager.RegisterRoomAwareObjectForUpdate(roomAwareObjectsEntered[i]);
            roomAwareObjectsDetectedWhileDisabled.Add(roomAwareObjectsEntered[i]);
        }
        roomAwareObjectsEntered.Clear();

        AkRoomManager.RegisterRoomUpdate(this);

        // in case a geometry was added with the room's ID, remove it
        if (previousColliderType == typeof(UnityEngine.MeshCollider) ||
            previousColliderType == typeof(UnityEngine.BoxCollider) ||
            previousColliderType == typeof(UnityEngine.SphereCollider) ||
            previousColliderType == typeof(UnityEngine.CapsuleCollider))
        {
            AkSoundEngine.RemoveGeometry(GetID());
        }
        previousColliderType = null;

        // stop sounds applied to the room game object
        AkSoundEngine.StopAll(GetID());

        RoomCount--;
        AkSoundEngine.RemoveRoom(GetID());
    }
Exemple #2
0
    public override void OnEnable()
    {
        var roomParams = new AkRoomParams
        {
            Up    = transform.up,
            Front = transform.forward,

            ReverbAuxBus  = reverbAuxBus.Id,
            ReverbLevel   = reverbLevel,
            WallOcclusion = wallOcclusion,

            RoomGameObj_AuxSendLevelToSelf = roomToneAuxSend,
            RoomGameObj_KeepRegistered     = roomToneEvent.IsValid(),
        };

        RoomCount++;
        AkSoundEngine.SetRoom(GetID(), roomParams, name);

        /// In case a room is disabled and re-enabled.
        AkRoomManager.RegisterRoomUpdate(this);

        // if objects entered the room while disabled, enter them now
        for (var i = 0; i < roomAwareObjectsDetectedWhileDisabled.Count; ++i)
        {
            AkRoomAwareManager.ObjectEnteredRoom(roomAwareObjectsDetectedWhileDisabled[i], this);
        }

        roomAwareObjectsDetectedWhileDisabled.Clear();
        base.OnEnable();
    }
Exemple #3
0
    private void OnEnable()
    {
        AkRoomAwareManager.RegisterRoomAwareObject(this);

        for (int i = 0; i < roomPriorityList.Count; ++i)
        {
            roomPriorityList[i].TryEnter(this);
        }
    }
Exemple #4
0
    private void OnDisable()
    {
        for (int i = 0; i < roomPriorityList.Count; ++i)
        {
            roomPriorityList[i].Exit(this);
        }

        AkRoomAwareManager.UnregisterRoomAwareObject(this);

        SetGameObjectInRoom(null);
    }
Exemple #5
0
    private void OnEnable()
    {
        roomCollider = GetComponent <UnityEngine.Collider>();

        SetRoom();

        // if objects entered the room while disabled, enter them now
        for (var i = 0; i < roomAwareObjectsDetectedWhileDisabled.Count; ++i)
        {
            AkRoomAwareManager.ObjectEnteredRoom(roomAwareObjectsDetectedWhileDisabled[i], this);
        }

        roomAwareObjectsDetectedWhileDisabled.Clear();
    }
Exemple #6
0
    private void OnDisable()
    {
        for (var i = 0; i < roomAwareObjectsEntered.Count; ++i)
        {
            roomAwareObjectsEntered[i].ExitedRoom(this);
            AkRoomAwareManager.RegisterRoomAwareObjectForUpdate(roomAwareObjectsEntered[i]);
            roomAwareObjectsDetectedWhileDisabled.Add(roomAwareObjectsEntered[i]);
        }
        roomAwareObjectsEntered.Clear();

        AkRoomManager.RegisterRoomUpdate(this);

        RoomCount--;
        AkSoundEngine.RemoveRoom(GetID());
    }
Exemple #7
0
    public void LateUpdate()
    {
#if UNITY_EDITOR
        if (!IsSoundEngineLoaded)
        {
            return;
        }
#endif

        //Execute callbacks that occurred in last frame (not the current update)
        AkRoomManager.Update();
        AkRoomAwareManager.UpdateRoomAwareObjects();
        AkCallbackManager.PostCallbacks();
        AkBankManager.DoUnloadBanks();
        AkSoundEngine.RenderAudio();
    }
Exemple #8
0
 private void OnTriggerExit(UnityEngine.Collider in_other)
 {
     AkRoomAwareManager.ObjectExitedRoom(in_other, this);
 }