Exemple #1
0
        /// <summary>
        /// Creates a time action and registers it to TimeManager.
        /// </summary>
        /// <returns>The time action.</returns>
        /// <param name="duration">Duration of the action</param>
        /// <param name="group">Group of the action</param>
        /// <param name="update_callback">Update callback.</param>
        /// <param name="end_callback">End callback.</param>
        public static TimeAction CreateTimeAction(float duration, eTimeGroup group, Action <TimeAction, float> update_callback = null, Action <TimeAction> end_callback = null)
        {
            TimeAction new_action = new TimeAction(duration, update_callback, end_callback);

            TimeManager.instance.AddAction(new_action, group);
            return(new_action);
        }
Exemple #2
0
        /// <summary>
        /// Add a new TimeAction to a group.
        /// </summary>
        /// <param name="new_action">New TimeAction to add.</param>
        /// <param name="group">Group where the TimeAction will be added.</param>
        public void AddAction(TimeAction new_action, eTimeGroup group = eTimeGroup.common)
        {
            // If group doesn't exist, create it.
            if (_next_actions.ContainsKey(group) == false)
            {
                _next_actions.Add(group, new List <TimeAction>());
            }

            if (new_action != null)
            {
                _next_actions[group].Add(new_action);
            }
            else
            {
                Debug.LogError("Can't add null TimeAction to TimeManager.");
            }
        }