Ejemplo n.º 1
0
        /// <summary>
        /// Add a new event with an argumentto be executed in the future.
        /// </summary>
        /// <param name="delay">The delay from the current time to execute the event.</param>
        /// <param name="callback">The delegate to execute after the specified delay.</param>
        /// <param name="arg">The argument of the delegate.</param>
        /// <returns>The ScheduledEvent instance, useful if the event should be cancelled.</returns>
        public static ScheduledEvent Schedule(float delay, Action <object> callback, object arg)
        {
            if (Instance == null)
            {
                return(null);
            }

            return(Instance.AddEventInternal(delay, callback, arg));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Schedule a new event to occur after the specified delay.
        /// </summary>
        /// <param name="delay">The time to wait before triggering the event.</param>
        /// <param name="callback">The event to occur.</param>
        /// <returns>The ScheduledEvent, allows for cancelling.</returns>
        public static ScheduledEvent Schedule(float delay, Action callback)
        {
            if (Instance == null)
            {
                return(null);
            }

            return(Instance.AddEventInternal(delay, callback));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add a new event with three arguments which will be executed in the future within the FixedUpdate loop.
        /// </summary>
        /// <param name="delay">The delay from the current time to execute the event.</param>
        /// <param name="action">The delegate to execute after the specified delay.</param>
        /// <param name="value1">The first value to use when invoking the delegate.</param>
        /// <param name="value2">The second value to use when invoking the delegate.</param>
        /// <param name="value3">The third value to use when invoking the delegate.</param>
        /// <returns>The ScheduledEventBase instance, useful if the event should be cancelled.</returns>
        public static ScheduledEventBase ScheduleFixed <T, U, V>(float delay, Action <T, U, V> action, T value1, U value2, V value3)
        {
            // Objects may be wanting to be scheduled as the game is stopping but the Scheduler has already been destroyed. Ensure the Scheduler is still valid.
            if (Instance == null)
            {
                return(null);
            }

            return(Instance.AddEventInternal(delay, ScheduledEventBase.InvokeLocation.FixedUpdate, action, value1, value2, value3));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Schedule a new event to occur after the specified delay within the Update loop.
        /// </summary>
        /// <param name="delay">The time to wait before triggering the event.</param>
        /// <param name="action">The event to occur.</param>
        /// <returns>The ScheduledEventBase instance, useful if the event should be cancelled.</returns>
        public static ScheduledEventBase Schedule(float delay, Action action)
        {
            // Objects may be wanting to be scheduled as the game is stopping but the Scheduler has already been destroyed. Ensure the Scheduler is still valid.
            if (Instance == null)
            {
                return(null);
            }

            return(Instance.AddEventInternal(delay, ScheduledEventBase.InvokeLocation.Update, action));
        }