Beispiel #1
0
        /// <summary>
        /// adds a new element to the list
        /// </summary>
        /// <param name="element"></param>
        public void Add(IActionQueueElement element)
        {
            if (element != null)
            {
                _list.Add(element);

                element.OnStart();
            }
        }
		/// <summary>
		/// adds a new element to the list
		/// </summary>
		/// <param name="element"></param>
		public void Add(IActionQueueElement element)
		{
			if (element != null)
			{
				_list.Add(element);

				element.OnStart();
			}
		}
Beispiel #3
0
        /// <summary>
        /// adds a new element to the back of the queue
        /// </summary>
        /// <param name="element"></param>
        public void Add(IActionQueueElement element)
        {
            if (element != null)
            {
                _queue.Enqueue(element);

                if (_queue.Count == 1)
                {
                    element.OnStart();
                }
            }
        }
		/// <summary>
		/// adds a new element to the back of the queue
		/// </summary>
		/// <param name="element"></param>
		public void Add(IActionQueueElement element)
		{
			if (element != null)
			{
				_queue.Enqueue(element);

				if (_queue.Count == 1)
				{
					element.OnStart();
				}
			}
		}
Beispiel #5
0
        // ================================================================================
        //  public methods
        // --------------------------------------------------------------------------------

        /// <summary>
        /// should be called every frame by parent object
        /// </summary>
        public void Update()
        {
            if (_queue.Count == 0)
            {
                return;
            }

            IActionQueueElement currentElement = _queue.Peek();

            currentElement.Update();

            if (currentElement.hasEnded)
            {
                currentElement.OnExit();
                _queue.Dequeue();

                if (_queue.Count > 0)
                {
                    currentElement = _queue.Peek();
                    currentElement.OnStart();
                }
            }
        }