コード例 #1
0
 /// <summary>
 /// Add an action to the end of the queue.
 /// </summary>
 /// <param name="action">The action to add to the end of the queue.</param>
 public void AddAction(ActorAction action)
 {
     if (action != null)
     {
         this.actions.AddLast(action);
     }
 }
コード例 #2
0
        public void AddToFront(ActorAction action)
        {
            if (action != null)
            {
                if (this.actions.First != null)
                {
                    this.actions.First.Value.enabled = false;
                }

                this.actions.AddFirst(action);
                this.actions.First.Value.enabled = true;
            }
        }
コード例 #3
0
        /// <summary>
        /// Removes all currently queued actions from the queue, and replaces them with a new action.
        /// </summary>
        /// <param name="action">The action to perform immediately, cancelling all other actions.</param>
        public void SetAction(ActorAction action)
        {
            foreach (ActorAction queuedAction in actions)
            {
                Destroy(queuedAction);
            }

            actions.Clear();
            actions.AddLast(action);

            if (actions.Count > 0)
            {
                actions.First.Value.enabled = true;
            }
        }
コード例 #4
0
        void Update()
        {
            if (actions.Count > 0)
            {
                if (actions.First.Value.Complete == true)
                {
                    ActorAction action = actions.First.Value;
                    actions.RemoveFirst();
                    Destroy(action);

                    // Enable the next action in the queue
                    if (actions.Count > 0)
                    {
                        actions.First.Value.enabled = true;
                    }
                }
            }
        }