ExecuteActionOnEvent() public static méthode

public static ExecuteActionOnEvent ( string in_pszEventName, AkActionOnEventType in_ActionType ) : AKRESULT
in_pszEventName string
in_ActionType AkActionOnEventType
Résultat AKRESULT
        public static void ResumeEvent(string eventName, GameObject gameObject, int fadeout)
        {
            uint eventID;

            eventID = AkSoundEngine.GetIDFromString(eventName);
            AkSoundEngine.ExecuteActionOnEvent(eventID, AkActionOnEventType.AkActionOnEventType_Resume, gameObject, fadeout * 1000, AkCurveInterpolation.AkCurveInterpolation_Sine);
        }
Exemple #2
0
 public override void HandleEvent(GameObject in_gameObject)
 {
     if (this.multiPositionTypeLabel != MultiPositionTypeLabel.MultiPosition_Mode)
     {
         base.HandleEvent(in_gameObject);
     }
     else
     {
         AkMultiPosEvent akMultiPosEvent = AkAmbient.multiPosEventTree[this.eventID];
         if (akMultiPosEvent.eventIsPlaying)
         {
             return;
         }
         akMultiPosEvent.eventIsPlaying = true;
         this.soundEmitterObject        = akMultiPosEvent.list[0].gameObject;
         if (this.enableActionOnEvent)
         {
             AkSoundEngine.ExecuteActionOnEvent((uint)this.eventID, this.actionOnEventType, akMultiPosEvent.list[0].gameObject, (int)this.transitionDuration * 1000, this.curveInterpolation);
         }
         else
         {
             AkSoundEngine.PostEvent((uint)this.eventID, akMultiPosEvent.list[0].gameObject, 1u, new AkCallbackManager.EventCallback(akMultiPosEvent.FinishedPlaying), null, 0u, null, 0u);
         }
     }
 }
Exemple #3
0
    /// <summary>
    /// Used to resume an audio event. includes a fade in.
    /// </summary>
    /// <param name="eventName">Name opf the event to be resumed</param>
    /// <param name="fadeOut"> Fade in time</param>
    public void Resume(string eventName, float fadeIn)
    {
        uint eventID;

        eventID = AkSoundEngine.GetIDFromString(eventName);
        AkSoundEngine.ExecuteActionOnEvent(eventID, AkActionOnEventType.AkActionOnEventType_Resume, gameObject, (int)(fadeIn * 1000), AkCurveInterpolation.AkCurveInterpolation_Sine);
    }
Exemple #4
0
    public override void HandleEvent(GameObject in_gameObject)
    {
        GameObject gameObj = (useOtherObject && in_gameObject != null) ? in_gameObject : gameObject;

        soundEmitterObject = gameObj;

        if (enableActionOnEvent)
        {
            AkSoundEngine.ExecuteActionOnEvent((uint)eventID, actionOnEventType, gameObj, (int)transitionDuration * 1000, curveInterpolation);
            return;
        }
        else if (m_callbackData != null)
        {
            playingId = AkSoundEngine.PostEvent((uint)eventID, gameObj, (uint)m_callbackData.uFlags, Callback, null, 0, null, AkSoundEngine.AK_INVALID_PLAYING_ID);
        }
        else
        {
            playingId = AkSoundEngine.PostEvent((uint)eventID, gameObj);
        }

        if (playingId == AkSoundEngine.AK_INVALID_PLAYING_ID)
        {
            Debug.LogError("Could not post event ID \"" + eventID + "\". Did you make sure to load the appropriate SoundBank?");
        }
    }
Exemple #5
0
    public void PauseEvent(string eventName, int fadeout)
    {
        uint eventId;

        eventId = AkSoundEngine.GetIDFromString(eventName);
        AkSoundEngine.ExecuteActionOnEvent(eventId, AkActionOnEventType.AkActionOnEventType_Pause, gameObject, fadeout * 1000, AkCurveInterpolation.AkCurveInterpolation_Sine);
    }
Exemple #6
0
    public override void HandleEvent(GameObject in_gameObject)
    {
        if (multiPositionTypeLabel != MultiPositionTypeLabel.MultiPosition_Mode)
        {
            base.HandleEvent(in_gameObject);
        }
        else
        {
            AkMultiPosEvent multiPositionSoundEmitter = multiPosEventTree[eventID];
            if (multiPositionSoundEmitter.eventIsPlaying)
            {
                return;
            }

            multiPositionSoundEmitter.eventIsPlaying = true;

            soundEmitterObject = multiPositionSoundEmitter.list[0].gameObject;

            if (enableActionOnEvent)
            {
                AkSoundEngine.ExecuteActionOnEvent((uint)eventID, actionOnEventType, multiPositionSoundEmitter.list[0].gameObject, (int)transitionDuration * 1000, curveInterpolation);
            }
            else
            {
                playingId = AkSoundEngine.PostEvent((uint)eventID, multiPositionSoundEmitter.list[0].gameObject, (uint)AkCallbackType.AK_EndOfEvent, multiPositionSoundEmitter.FinishedPlaying, null, 0, null, AkSoundEngine.AK_INVALID_PLAYING_ID);
            }
        }
    }
    public void StopEvent(string eventName)
    {
        uint eventID;

        eventID = AkSoundEngine.GetIDFromString(eventName);
        AkSoundEngine.ExecuteActionOnEvent(eventID, AkActionOnEventType.AkActionOnEventType_Stop, gameObject, 0, AkCurveInterpolation.AkCurveInterpolation_Sine);
    }
Exemple #8
0
        internal void StopEvent(AudioEventItem econfig, AkGameObj target)
        {
            var result = AkSoundEngine.ExecuteActionOnEvent(econfig.Event, AkActionOnEventType.AkActionOnEventType_Stop,
                                                            target.gameObject, 0, AkCurveInterpolation.AkCurveInterpolation_Linear);

            AudioUtil.VerifyAKResult(result, "StopEvent:" + econfig.Event);
        }
Exemple #9
0
 public static void Continue(string name)
 {
     if (string.IsNullOrEmpty(name))
     {
         return;
     }
     AkSoundEngine.ExecuteActionOnEvent(name, AkActionOnEventType.AkActionOnEventType_Resume);
 }
Exemple #10
0
    private static void DoActionOnEvent(string eventName, AkActionOnEventType action, int fadeout)
    {
        uint eventID = AkSoundEngine.GetIDFromString(eventName);

        //default curve of event action is log, but can change later
        AkSoundEngine.ExecuteActionOnEvent(eventID, action, Instance.gameObject, fadeout, AkCurveInterpolation.AkCurveInterpolation_Log1);
        AkSoundEngine.RenderAudio();
    }
 /// <summary>
 /// Executes various actions on this event associated with a GameObject.
 /// </summary>
 /// <param name="gameObject">The GameObject</param>
 /// <param name="actionOnEventType"></param>
 /// <param name="transitionDuration"></param>
 /// <param name="curveInterpolation"></param>
 public void ExecuteAction(GameObject gameObject, AkActionOnEventType actionOnEventType, int transitionDuration, AkCurveInterpolation curveInterpolation)
 {
     if (IsValid())
     {
         AKRESULT result = AkSoundEngine.ExecuteActionOnEvent(GetID(), actionOnEventType, gameObject, transitionDuration, curveInterpolation);
         Verify(result);
     }
 }
Exemple #12
0
    public void Stop(int _transitionDuration, AkCurveInterpolation _curveInterpolation)
    {
        if (eventID == (int)AkSoundEngine.AK_INVALID_UNIQUE_ID)
        {
            return;
        }

        AkSoundEngine.ExecuteActionOnEvent((uint)eventID, AkActionOnEventType.AkActionOnEventType_Stop, soundEmitterObject,
                                           _transitionDuration, _curveInterpolation);
    }
Exemple #13
0
 /// <summary>
 ///     Executes various actions on this event associated with a GameObject.
 /// </summary>
 /// <param name="gameObject">The GameObject</param>
 /// <param name="actionOnEventType"></param>
 /// <param name="transitionDuration"></param>
 /// <param name="curveInterpolation"></param>
 public void ExecuteAction(UnityEngine.GameObject gameObject, AkActionOnEventType actionOnEventType,
                           int transitionDuration, AkCurveInterpolation curveInterpolation)
 {
     if (IsValid())
     {
         var result = AkSoundEngine.ExecuteActionOnEvent(Id, actionOnEventType, gameObject, transitionDuration,
                                                         curveInterpolation);
         Verify(result);
     }
 }
Exemple #14
0
    public AKRESULT StopSound(uint eventID, GameObject gameObj        = null, int transitionDuration = 300,
                              AkCurveInterpolation curveInterpolation = AkCurveInterpolation.AkCurveInterpolation_Linear)
    {
        transitionDuration = Mathf.Clamp(transitionDuration, 0, 10000);
        if (gameObj == null)
        {
            gameObj = mGlobalObject;
        }
        AKRESULT result = AkSoundEngine.ExecuteActionOnEvent(eventID, AkActionOnEventType.AkActionOnEventType_Stop, gameObj, transitionDuration, curveInterpolation);

        return(result);
    }
Exemple #15
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Hide")
        {
            can_Hide = true;
        }

        if (collision.tag == "MusicBox")
        {
            float x = Random.Range(this.transform.position.x + 15.0f, this.transform.position.x - 15.0f);
            while (x > 58 | x < -58)
            {
                x = Random.Range(this.transform.position.x + 15.0f, this.transform.position.x - 15.0f);
            }
            float y = Random.Range(this.transform.position.y + 15.0f, this.transform.position.y + 15.0f * -1);
            while (y > 48 | y < -18)
            {
                y = Random.Range(this.transform.position.y + 15.0f, this.transform.position.y + 15.0f * -1);
            }
            if (counter <= 2)
            {
                GameObject clown = Instantiate(Resources.Load("clown"), new Vector2(x, y), Quaternion.identity) as GameObject;
            }
            else if (counter <= 4)
            {
                GameObject doll = Instantiate(Resources.Load("doll"), new Vector2(x, y), Quaternion.identity) as GameObject;
            }
            else if (counter <= 6)
            {
                GameObject robot = Instantiate(Resources.Load("robot"), new Vector2(x, y), Quaternion.identity) as GameObject;
            }

            //stop the music box sound
            AkSoundEngine.ExecuteActionOnEvent(3940140778, AkActionOnEventType.AkActionOnEventType_Stop, collision.gameObject, 1);

            Destroy(collision.gameObject);
            counter += 1;
        }

        if (collision.tag == "Clown")
        {
            if (this.GetComponent <PlayerMovement>().hide == false)
            {
                Debug.Log("Clown sees you");
                collision.GetComponent <Vision>().chase = true;
            }
        }
        if (collision.tag == "Exit")
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene("Win");
        }
    }
    public void PauseEvent(string eventName, float fadeout)
    {
        uint eventID;

        eventID = AkSoundEngine.GetIDFromString(eventName);
        int fadeoutMs = (int)fadeout * 1000;

        AkSoundEngine.ExecuteActionOnEvent(
            eventID,
            AkActionOnEventType.AkActionOnEventType_Pause,
            gameObject,
            fadeoutMs,
            AkCurveInterpolation.AkCurveInterpolation_Sine);
    }
Exemple #17
0
 public AKRESULT StopVoice(string eventName, GameObject gameObj = null, int transitionDuration = 200)
 {
     if (!string.IsNullOrEmpty(eventName))
     {
         transitionDuration = Mathf.Clamp(transitionDuration, 0, 10000);
         if (gameObj == null)
         {
             gameObj = mGlobalObject;
         }
         AKRESULT result = AkSoundEngine.ExecuteActionOnEvent(eventName, AkActionOnEventType.AkActionOnEventType_Stop, gameObj, transitionDuration, AkCurveInterpolation.AkCurveInterpolation_Linear);
         return(result);
     }
     return(AKRESULT.AK_Fail);
 }
Exemple #18
0
 public void StopAllExcutedEvents(AudioEmitterEditor instance)
 {
     foreach (var evt in unStopedEvents)
     {
         var result = AkSoundEngine.ExecuteActionOnEvent(evt, AkActionOnEventType.AkActionOnEventType_Stop, instance.gameObject,
                                                         AudioConstEditor.DefaultExcuteTransition * 1000,
                                                         AudioConstEditor.DefaultExcuteInterpolation);
         if (result != AKRESULT.AK_Success && instance.EnableEmitterLog)
         {
             DebugUtil.MyLog("[Emitter] PlayExcuteTemplate result :" + result);
         }
     }
     unStopedEvents.Clear();
 }
Exemple #19
0
    public void IncompleteAction(string eventName, bool complete)
    {
        //if bool is true, POST EVENT
        if (complete == true)
        {
            AkSoundEngine.PostEvent(eventName, gameObject);
        }

        if (complete == false)
        {
            uint eventId;
            eventId = AkSoundEngine.GetIDFromString(eventName);
            AkSoundEngine.ExecuteActionOnEvent(eventId, AkActionOnEventType.AkActionOnEventType_Stop, gameObject, 0, AkCurveInterpolation.AkCurveInterpolation_Linear);
        }

        //if bool is false, STOP EVENT
    }
Exemple #20
0
    public void StopLastExcutedEvent(AudioEmitterEditor instance)
    {
        if (string.IsNullOrEmpty(lastExcutedEvent))
        {
            return;
        }
        var result = AkSoundEngine.ExecuteActionOnEvent(lastExcutedEvent, AkActionOnEventType.AkActionOnEventType_Stop, instance.gameObject,
                                                        AudioConstEditor.DefaultExcuteTransition * 1000,
                                                        AudioConstEditor.DefaultExcuteInterpolation);

        if (result != AKRESULT.AK_Success && instance.EnableEmitterLog)
        {
            DebugUtil.MyLog("[Emitter] PlayExcuteTemplate result :" + result);
        }

        lastExcutedEvent = null;
    }
Exemple #21
0
    public override void HandleEvent(GameObject in_gameObject)
    {
        GameObject in_gameObjectID = (!this.useOtherObject || !(in_gameObject != null)) ? base.gameObject : in_gameObject;

        this.soundEmitterObject = in_gameObjectID;
        if (this.enableActionOnEvent)
        {
            AkSoundEngine.ExecuteActionOnEvent((uint)this.eventID, this.actionOnEventType, in_gameObjectID, (int)this.transitionDuration * 1000, this.curveInterpolation);
        }
        else if (this.m_callbackData != null)
        {
            AkSoundEngine.PostEvent((uint)this.eventID, in_gameObjectID, (uint)this.m_callbackData.uFlags, new AkCallbackManager.EventCallback(this.Callback), null, 0u, null, 0u);
        }
        else
        {
            AkSoundEngine.PostEvent((uint)this.eventID, in_gameObjectID);
        }
    }
Exemple #22
0
        public void StopEvent(AkEvent akEvent)
        {
            if (!IsEventPlaying(akEvent))
            {
                return;
            }

            AKRESULT result = AkSoundEngine.ExecuteActionOnEvent((uint)akEvent.eventID, AkActionOnEventType.AkActionOnEventType_Stop, akEvent.gameObject, 0);

            if (result == AKRESULT.AK_Success)
            {
                RemoveAkEvent(akEvent);
            }
            else
            {
                Debug.LogWarning("WwiseUnity: AkEditorEventPlayer: Failed to stop event: " + akEvent.name + "(id: " + akEvent.eventID + ")!");
            }
        }
Exemple #23
0
    public override void HandleEvent(GameObject in_gameObject)
    {
        GameObject obj2 = (!base.useOtherObject || (in_gameObject == null)) ? base.gameObject : in_gameObject;

        this.soundEmitterObject = obj2;
        if (this.enableActionOnEvent)
        {
            AkSoundEngine.ExecuteActionOnEvent((uint)this.eventID, this.actionOnEventType, obj2, ((int)this.transitionDuration) * 0x3e8, this.curveInterpolation);
        }
        else if (this.m_callbackData != null)
        {
            AkSoundEngine.PostEvent((uint)this.eventID, obj2, (uint)this.m_callbackData.uFlags, new AkCallbackManager.EventCallback(this.Callback), null, 0, null, 0);
        }
        else
        {
            AkSoundEngine.PostEvent((uint)this.eventID, obj2);
        }
    }
Exemple #24
0
        /// <summary>
        ///     Executes various actions on this event associated with a GameObject.
        /// </summary>
        /// <param name="gameObject">The GameObject</param>
        /// <param name="actionOnEventType"></param>
        /// <param name="transitionDuration"></param>
        /// <param name="curveInterpolation"></param>
        public void ExecuteAction(UnityEngine.GameObject gameObject, AkActionOnEventType actionOnEventType,
                                  int transitionDuration, AkCurveInterpolation curveInterpolation)
        {
            if (IsValid())
            {
#if AK_WWISE_ADDRESSABLES && UNITY_ADDRESSABLES
                var args     = new object[] { gameObject, actionOnEventType, transitionDuration, curveInterpolation };
                var argTypes = new System.Type[] { gameObject.GetType(), actionOnEventType.GetType(), transitionDuration.GetType(), curveInterpolation.GetType() };
                if (!AkAddressableBankManager.Instance.LoadedBankContainsEvent(Name, Id, this, "ExecuteAction", argTypes, args))
                {
                    return;
                }
#endif

                var result = AkSoundEngine.ExecuteActionOnEvent(Id, actionOnEventType, gameObject, transitionDuration,
                                                                curveInterpolation);
                Verify(result);
            }
        }
Exemple #25
0
    public override void HandleEvent(GameObject in_gameObject)
    {
        GameObject gameObj = (useOtherObject && in_gameObject != null) ? in_gameObject : gameObject;

        soundEmitterObject = gameObj;

        if (enableActionOnEvent)
        {
            AkSoundEngine.ExecuteActionOnEvent((uint)eventID, actionOnEventType, gameObj, (int)transitionDuration * 1000, curveInterpolation);
        }
        else if (m_callbackData != null)
        {
            AkSoundEngine.PostEvent((uint)eventID, gameObj, (uint)m_callbackData.uFlags, Callback, null, 0, null, AkSoundEngine.AK_INVALID_PLAYING_ID);
        }
        else
        {
            AkSoundEngine.PostEvent((uint)eventID, gameObj);
        }
    }
Exemple #26
0
 public AKRESULT StopSound(string eventName, GameObject gameObj = null, int transitionDuration = 300, AkCurveInterpolation curveInterpolation = AkCurveInterpolation.AkCurveInterpolation_Linear)
 {
     if (!CheckAndLoadBank(eventName))
     {
         return(AKRESULT.AK_Fail);
     }
     if (!string.IsNullOrEmpty(eventName))
     {
         transitionDuration = Mathf.Clamp(transitionDuration, 0, 10000);
         if (gameObj == null)
         {
             gameObj = mGlobalObject;
         }
         if (gameObj != null)
         {
             AKRESULT result = AkSoundEngine.ExecuteActionOnEvent(eventName, AkActionOnEventType.AkActionOnEventType_Stop, gameObj, transitionDuration, curveInterpolation);
             return(result);
         }
     }
     return(AKRESULT.AK_Fail);
 }
Exemple #27
0
    public void PlayEventExcuteTemplate(string eventName, AudioEmitterEditor audioEmitterEditor)
    {
        var result = AkSoundEngine.ExecuteActionOnEvent(eventName, ActionOnEventType, audioEmitterEditor.gameObject,
                                                        AudioConstEditor.DefaultExcuteTransition * 1000,
                                                        AudioConstEditor.DefaultExcuteInterpolation);

        if (audioEmitterEditor.EnableEmitterLog)
        {
            DebugUtil.MyLog("[Emitter] PlayExcuteTemplate result :" + result);
        }

        switch (ActionOnEventType)
        {
        case AkActionOnEventType.AkActionOnEventType_Resume:
            lastExcutedEvent = eventName;
            break;

        case AkActionOnEventType.AkActionOnEventType_Stop:
            unStopedEvents.Remove(eventName);
            break;
        }
    }
Exemple #28
0
 public override void HandleEvent(GameObject in_gameObject)
 {
     if (this.multiPositionTypeLabel != MultiPositionTypeLabel.MultiPosition_Mode)
     {
         base.HandleEvent(in_gameObject);
     }
     else
     {
         AkMultiPosEvent event2 = multiPosEventTree[base.eventID];
         if (!event2.eventIsPlaying)
         {
             event2.eventIsPlaying   = true;
             base.soundEmitterObject = event2.list[0].gameObject;
             if (base.enableActionOnEvent)
             {
                 AkSoundEngine.ExecuteActionOnEvent((uint)base.eventID, base.actionOnEventType, event2.list[0].gameObject, ((int)base.transitionDuration) * 0x3e8, base.curveInterpolation);
             }
             else
             {
                 AkSoundEngine.PostEvent((uint)base.eventID, event2.list[0].gameObject, 1, new AkCallbackManager.EventCallback(event2.FinishedPlaying), null, 0, null, 0);
             }
         }
     }
 }
Exemple #29
0
 public void Stop(int _transitionDuration, AkCurveInterpolation _curveInterpolation = AkCurveInterpolation.AkCurveInterpolation_Linear)
 {
     AkSoundEngine.ExecuteActionOnEvent((uint)eventID, AkActionOnEventType.AkActionOnEventType_Stop, soundEmitterObject, _transitionDuration, _curveInterpolation);
 }
Exemple #30
0
 public static void PauseEvent(string s, GameObject g)
 {
     AkSoundEngine.ExecuteActionOnEvent(s, AkActionOnEventType.AkActionOnEventType_Stop, g);
 }