Exemplo n.º 1
0
        public GalaxyState() : base()
        {
            _mouseObs = new MouseNotifier();

            // Create star-system markers
            for (int i = 0; i < 13; i++)
            {
                CreationQueue.Add(CreateMarker());
            }
            // Create galaxy
            CreateGameObject(GameObjType.galaxy);
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
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);
            }
        }