/// <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(); }
/// <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); } }