Ejemplo n.º 1
0
    private void Awake()
    {
        if (!this.isStaticObject)
        {
            this.m_posData = new AkGameObjPositionData();
        }
        Collider component = base.GetComponent <Collider>();

        this.coll = component;
        if (component != null)
        {
            this.GameObjColliderBounds = base.GetComponent <Collider>().bounds;
            component.enabled          = false;
        }
        AKRESULT aKRESULT = AkSoundEngine.RegisterGameObj(base.gameObject, base.gameObject.name, (uint)(this.listenerMask & 255));

        if (aKRESULT == AKRESULT.AK_Success)
        {
            Vector3 position = this.GetPosition();
            AkSoundEngine.SetObjectPosition(base.gameObject, position.x, position.y, position.z, base.transform.forward.x, base.transform.forward.y, base.transform.forward.z);
            if (this.isEnvironmentAware)
            {
                this.m_envData = new AkGameObjEnvironmentData();
                this.AddAuxSend(base.gameObject);
            }
        }
    }
Ejemplo n.º 2
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.
                AddAuxSend(gameObject);
            }
        }
    }
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
    private void Awake()
    {
        if (!this.isStaticObject)
        {
            this.m_posData = new AkGameObjPositionData();
        }
        AkSoundEngine.RegisterGameObj(base.gameObject, base.gameObject.name);
        Vector3 position = this.GetPosition();

        AkSoundEngine.SetObjectPosition(base.gameObject, position.x, position.y, position.z, base.transform.forward.x, base.transform.forward.y, base.transform.forward.z);
        if (this.isEnvironmentAware)
        {
            this.m_envData = new AkGameObjEnvironmentData();
            this.AddAuxSend(base.gameObject);
        }
    }
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 Awake()
    {
        // If the object was marked as static, don't update its position to save cycles.
#if UNITY_EDITOR
        if (!UnityEditor.EditorApplication.isPlaying)
        {
            //set enabled to true and is static to false to make sure that the update function is called in edit mode
            //the correct value for the isStaticObject variable will be set when update is called
            isStaticObject = false;
            enabled        = true;
            return;
        }
#endif
        if (!isStaticObject)
        {
            m_posData = new AkGameObjPositionData();
        }

        //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);

            if (isEnvironmentAware)
            {
                m_envData = new AkGameObjEnvironmentData();
                //Check if this object is also an environment.
                AddAuxSend(gameObject);
            }
        }
    }
Ejemplo n.º 8
0
	void Awake()
    {			
		// If the object was marked as static, don't update its position to save cycles.
#if UNITY_EDITOR
		if (!UnityEditor.EditorApplication.isPlaying)	
		{
			//set enabled to true and is static to false to make sure that the update function is called in edit mode
			//the correct value for the isStaticObject variable will be set when update is called
			isStaticObject = false;
			enabled = true;
			return;
		}
#endif 
		if(!isStaticObject)
		{
			m_posData = new AkGameObjPositionData();
		}		
	
        //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);

            if (isEnvironmentAware)
            {
                m_envData = new AkGameObjEnvironmentData();
                //Check if this object is also an environment.
                AddAuxSend(gameObject);
            }
        }
    }
Ejemplo n.º 9
0
	void Awake()
    {			
		// 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;
		}
#endif 
		if(!isStaticObject)
		{
			m_posData = new AkGameObjPositionData();
		}		
		
		// Cache the bounds to avoid calls to GetComponent()
		GameObjColliderBounds = GetComponent<Collider>().bounds;
	
        //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);

            if (isEnvironmentAware)
            {
                m_envData = new AkGameObjEnvironmentData();
                //Check if this object is also an environment.
                AddAuxSend(gameObject);
            }
        }
    }