Ejemplo n.º 1
0
    void Awake()
    {
#if UNITY_EDITOR
        if (AkUtilities.IsMigrating)
        {
            return;
        }
#endif

        // If the object was marked as static, don't update its position to save cycles.
#if UNITY_EDITOR
        if (!UnityEditor.EditorApplication.isPlaying)
        {
            UnityEditor.EditorApplication.update += this.CheckStaticStatus;
            return;
        }
#endif
        if (!isStaticObject)
        {
            m_posData = new AkGameObjPositionData();
        }

        // Cache the bounds to avoid calls to GetComponent()
        m_Collider = GetComponent <Collider>();

        //Register a Game Object in the sound engine, with its name.
        AKRESULT res = AkSoundEngine.RegisterGameObj(gameObject, gameObject.name, (uint)(listenerMask & ALL_LISTENER_MASK));
        if (res == AKRESULT.AK_Success)
        {
            // Get position with offset
            Vector3 position = GetPosition();

            //Set the original position
            AkSoundEngine.SetObjectPosition(
                gameObject,
                position.x,
                position.y,
                position.z,
                transform.forward.x,
                transform.forward.y,
                transform.forward.z,
                transform.up.x,
                transform.up.y,
                transform.up.z);

            if (isEnvironmentAware)
            {
                m_envData = new AkGameObjEnvironmentData();
                //Check if this object is also an environment.
                m_envData.AddAkEnvironment(gameObject, gameObject);
            }
        }
    }
Ejemplo n.º 2
0
    private void OnTriggerEnter(UnityEngine.Collider other)
    {
#if UNITY_EDITOR
        if (AkUtilities.IsMigrating || !UnityEditor.EditorApplication.isPlaying)
        {
            return;
        }
#endif

        if (isEnvironmentAware && m_envData != null)
        {
            m_envData.AddAkEnvironment(other, m_Collider);
        }
    }
Ejemplo n.º 3
0
    void Awake()
    {
#if UNITY_EDITOR
        if (AkUtilities.IsMigrating)
        {
            return;
        }

        // If the object was marked as static, don't update its position to save cycles.
        if (!UnityEditor.EditorApplication.isPlaying)
        {
            UnityEditor.EditorApplication.update += this.CheckStaticStatus;
            return;
        }
#endif
        if (!isStaticObject)
        {
            m_posData = new AkGameObjPositionData();
        }

        // Cache the bounds to avoid calls to GetComponent()
        m_Collider = GetComponent <Collider>();

        //Register a Game Object in the sound engine, with its name.
        AKRESULT res = AkSoundEngine.RegisterGameObj(gameObject, gameObject.name);
        if (res == AKRESULT.AK_Success)
        {
            // Get position with offset or custom position and orientation.
            Vector3 position = GetPosition();
            Vector3 forward  = GetForward();
            Vector3 up       = GetUpward();

            //Set the original position
            AkSoundEngine.SetObjectPosition(
                gameObject,
                position.x, position.y, position.z,
                forward.x, forward.y, forward.z,
                up.x, up.y, up.z);

            if (isEnvironmentAware && m_Collider)
            {
                m_envData = new AkGameObjEnvironmentData();
                //Check if this object is also an environment.
                m_envData.AddAkEnvironment(m_Collider, m_Collider);
            }

            m_listeners.Initialize();
        }
    }
Ejemplo n.º 4
0
    void OnTriggerEnter(Collider other)
    {
#if !DISABLE_AKSOUNDENGINE
#if UNITY_EDITOR
        if (AkMigrating.IsMigrating || !UnityEditor.EditorApplication.isPlaying)
        {
            return;
        }
#endif

        if (isEnvironmentAware && m_envData != null)
        {
            m_envData.AddAkEnvironment(other, m_Collider);
        }
#endif
    }
Ejemplo n.º 5
0
    void Awake()
    {
#if UNITY_EDITOR
        if (AkUtilities.IsMigrating)
        {
            return;
        }

        if (!UnityEditor.EditorApplication.isPlaying)
        {
            UnityEditor.EditorApplication.update += this.CheckStaticStatus;
        }
#endif

        // If the object was marked as static, don't update its position to save cycles.
        if (!isStaticObject)
        {
            m_posData = new AkGameObjPositionData();
        }

        // Cache the bounds to avoid calls to GetComponent()
        m_Collider = GetComponent <Collider>();

        //Register a Game Object in the sound engine, with its name.
        AKRESULT res = AkSoundEngine.RegisterGameObj(gameObject, gameObject.name);
        if (res == AKRESULT.AK_Success)
        {
            // Get position with offset or custom position and orientation.
            //Set the original position
            AkSoundEngine.SetObjectPosition(gameObject, GetPosition(), GetForward(), GetUpward());

            if (isEnvironmentAware && m_Collider)
            {
                m_envData = new AkGameObjEnvironmentData();
                //Check if this object is also an environment.
                m_envData.AddAkEnvironment(m_Collider, m_Collider);

                m_envData.UpdateAuxSend(gameObject, transform.position);
            }

            int Count = m_listeners.initialListenerList.Count;
            for (int ii = 0; ii < Count; ++ii)
            {
                AddListener(m_listeners.initialListenerList[ii]);
            }
        }
    }
Ejemplo n.º 6
0
    private void Awake()
    {
#if UNITY_EDITOR
        if (!AkSoundEngineController.Instance.IsSoundEngineLoaded || AkUtilities.IsMigrating)
        {
            return;
        }

        if (!UnityEditor.EditorApplication.isPlaying)
        {
            UnityEditor.EditorApplication.update += CheckStaticStatus;
        }
#endif

        // If the object was marked as static, don't update its position to save cycles.
        if (!isStaticObject)
        {
            m_posData = new AkGameObjPositionData();
        }

        // Cache the bounds to avoid calls to GetComponent()
        m_Collider = GetComponent <UnityEngine.Collider>();

        //Register a Game Object in the sound engine, with its name.
        if (Register() == AKRESULT.AK_Success)
        {
            // Get position with offset or custom position and orientation.
            //Set the original position
            AkSoundEngine.SetObjectPosition(gameObject, GetPosition(), GetForward(), GetUpward());

            if (isEnvironmentAware)
            {
                m_envData = new AkGameObjEnvironmentData();

                if (m_Collider)
                {
                    m_envData.AddAkEnvironment(m_Collider, m_Collider);
                }

                m_envData.UpdateAuxSend(gameObject, transform.position);
            }

            m_listeners.Init(this);
        }
    }
Ejemplo n.º 7
0
    void OnTriggerEnter(Collider other)
    {
#if UNITY_EDITOR
        if (AkUtilities.IsMigrating)
        {
            return;
        }

        if (!UnityEditor.EditorApplication.isPlaying)
        {
            return;
        }
#endif

        if (isEnvironmentAware && m_envData != null)
        {
            m_envData.AddAkEnvironment(other.gameObject, gameObject);
        }
    }