コード例 #1
0
 /// <summary>
 /// Send an event to be processed in a specific update tick.
 /// </summary>
 /// <param name="target">The target to send the event to.</param>
 /// <param name="ev">The event to send</param>
 /// <param name="tick">The update tick to send to.</param>
 /// <typeparam name="T_Event">The event type.</typeparam>
 public static void SendEvent <T_Event>(EventTarget target, T_Event ev, EventUpdateTick tick)
     where T_Event : struct
 {
     if (tick == EventUpdateTick.FixedUpdate)
     {
         _fixedUpdateSystem.QueueEvent(target, ev);
     }
     else if (tick == EventUpdateTick.Update)
     {
         _updateSystem.QueueEvent(target, ev);
     }
     else             // Late Update
     {
         _lateUpdateSystem.QueueEvent(target, ev);
     }
 }
コード例 #2
0
 /// <summary>
 /// Unsubscribe a job that processed during from an event in the specific update tick.
 /// </summary>
 /// <param name="target">The target to unsubscribe from.</param>
 /// <param name="onComplete">The callback that is invoked when the job has finished.</param>
 /// <param name="tick">The update type to unsubscribe to.</param>
 /// <typeparam name="T_Job">The job type.</typeparam>
 /// <typeparam name="T_Event">The event type.</typeparam>
 public static void UnsubscribeWithJob <T_Job, T_Event>(EventTarget target, Action <T_Job> onComplete,
                                                        EventUpdateTick tick)
     where T_Job : struct, IJobForEvent <T_Event>
     where T_Event : struct
 {
     if (tick == EventUpdateTick.FixedUpdate)
     {
         _fixedUpdateSystem.UnsubscribeWithJob <T_Job, T_Event>(target, onComplete);
     }
     else if (tick == EventUpdateTick.Update)
     {
         _updateSystem.UnsubscribeWithJob <T_Job, T_Event>(target, onComplete);
     }
     else             // Late Update
     {
         _lateUpdateSystem.UnsubscribeWithJob <T_Job, T_Event>(target, onComplete);
     }
 }
コード例 #3
0
 /// <summary>
 /// Create an tick based event system.
 /// </summary>
 /// <param name="updateTick">Which tick to run in.</param>
 public TickEventSystem(EventUpdateTick updateTick)
 {
     _tick   = updateTick;
     _target = EventTarget.CreateTarget();
 }
コード例 #4
0
 /// <summary>
 /// Unsubscribe a listener from an event in the specific update tick.
 /// </summary>
 /// <param name="target">The target to unsubscribe from.</param>
 /// <param name="eventCallback">The event callback</param>
 /// <param name="tick">The update type to unsubscribe to.</param>
 /// <typeparam name="T_Event">The event</typeparam>
 public static void Unsubscribe <T_Event>(EventTarget target, Action <T_Event> eventCallback, EventUpdateTick tick)
     where T_Event : struct
 {
     if (tick == EventUpdateTick.FixedUpdate)
     {
         _fixedUpdateSystem.Unsubscribe(target, eventCallback);
     }
     else if (tick == EventUpdateTick.Update)
     {
         _updateSystem.Unsubscribe(target, eventCallback);
     }
     else             // Late Update
     {
         _lateUpdateSystem.Unsubscribe(target, eventCallback);
     }
 }