Esempio n. 1
0
 /// <summary>
 /// Post all actions in this event in accordance to the data specified in the inspector, but overrides another place to fire the sound from
 /// </summary>
 /// <param name="controllingObject">The controlling game object and the future parent of the audio files</param>
 /// <param name="eventList">All the events to post as added in the inspector</param>
 /// <param name="postAt">The new position to play at</param>
 public static void PostEventAtPosition(GameObject controllingObject, InAudioEvent eventList, Vector3 postAt)
 {
     if (instance != null && controllingObject != null && eventList != null && eventList.Events != null)
     {
         int count = eventList.Events.Count;
         for (int i = 0; i < count; i++)
         {
             EventHookListData eventData = eventList.Events[i];
             if (eventData != null && eventData.Event != null)
             {
                 instance.OnPostEvent(controllingObject, eventData.Event, postAt);
             }
         }
     }
     else
     {
         if (instance == null)
         {
             InDebug.InAudioInstanceMissing(controllingObject);
         }
         else if (controllingObject == null)
         {
             InDebug.MissingControllingObject();
         }
         else if (eventList == null || eventList.Events == null)
         {
             InDebug.MissingEventList(controllingObject);
         }
     }
 }
Esempio n. 2
0
    public void Add(InAudioEventNode audioEvent, EventHookListData.PostEventAt postAt)
    {
        var data = new EventHookListData(audioEvent);

        data.PostAt = postAt;
        Events.Add(data);
    }
Esempio n. 3
0
 /// <summary>
 /// Post all actions in this event in accordance to the data specified in the inspector, but overrides which object is it attached to.
 /// </summary>
 /// <param name="controllingObject">The controlling game object and the future parent of the audio files</param>
 /// <param name="eventList">All the events to post as added in the inspector</param>
 /// <param name="attachedToOther">The object to attach the events to</param>
 public static void PostEventAttachedTo(GameObject controllingObject, InAudioEvent eventList, GameObject attachedToOther)
 {
     if (instance != null && controllingObject != null && eventList != null && eventList.Events != null)
     {
         int     count    = eventList.Events.Count;
         Vector3 position = controllingObject.transform.position;
         for (int i = 0; i < count; i++)
         {
             EventHookListData eventData = eventList.Events[i];
             if (eventData != null && eventData.Event != null)
             {
                 if (eventData.PostAt == EventHookListData.PostEventAt.AttachedTo)
                 {
                     instance.OnPostEvent(controllingObject, eventData.Event, attachedToOther);
                 }
                 else //if post at position
                 {
                     instance.OnPostEvent(controllingObject, eventData.Event, position);
                 }
             }
         }
     }
     else
     {
         if (instance == null)
         {
             InDebug.InAudioInstanceMissing(controllingObject);
         }
         else if (controllingObject == null)
         {
             InDebug.MissingControllingObject();
         }
         else if (eventList == null || eventList.Events == null)
         {
             InDebug.MissingEventList(controllingObject);
         }
     }
 }