예제 #1
0
        /// <summary>
        /// Update all game objects
        /// </summary>
        public override void Update()
        {
            // Update GameObjects in world
            foreach (GameObject obj in Objs)
            {
                obj.Update();
            }

            // Add queued objects to world
            for (int i = CreationQueue.Count - 1; i > -1; i--)
            {
                Objs.Add(CreationQueue[i]);
                CreationQueue.RemoveAt(i);
            }

            _mouseObs.Update();
        }
예제 #2
0
        /// <summary>
        /// Remove objects from creation queue and
        /// add to object registry
        /// </summary>
        public void UnqueueObjects()
        {
            for (int i = CreationQueue.Count - 1; i > -1; i--)
            {
                Objs.Add(CreationQueue[i]);

                // Add to decayable registry and sort registry by time to live
                IDecay decay = CreationQueue[i] as IDecay;
                if (decay != null)
                {
                    Decayables.Add(decay);
                    Decayables = Decayables.OrderByDescending(d => d.TTL).ToList();
                }

                CreationQueue.RemoveAt(i);
            }
        }