Ejemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            foreach (AbstractCreature creature in creatures)
            {
                creature.Update(gameTime);
            }

            // Remove dead creatures
            // iterate backwards to remove them from the array as we loop
            for (int i = creatures.Count - 1; i >= 0; i--)
            {
                if (!creatures[i].alive)
                {
                    creatures.RemoveAt(i);
                }
            }

            if (blockUpdateQueue.Count == 0)
            {
                blockUpdateQueue = new UniqueQueue <byte[]>(nextBlockUpdateQueue);
                nextBlockUpdateQueue.Clear();
            }

            for (int i = 0; i < 64000 && blockUpdateQueue.Count > 0; i++)
            {
                byte[] blockPosition = blockUpdateQueue.Dequeue();
                blocks[blockPosition[0], blockPosition[1], blockPosition[2]].Update(gameTime);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets default values
        /// </summary>
        public void SetDefault()
        {
            foreach (WeaponIndex a in Enum.GetValues(typeof(WeaponIndex)))
            {
                if (!playerWeapons.ContainsKey(a))
                {
                    playerWeapons.Add(a, new WeaponItem(this, a, 0, false));
                }
                else
                {
                    playerWeapons[a].HealthRef.Value = 0;
                    playerWeapons[a].IsBought        = false;
                }
            }

            selectedWeapons.Clear();
        }
Ejemplo n.º 3
0
        public override void OnMapClosedClient()
        {
            lock (chunksToGenLock)
            {
                chunksToGen.Clear();
            }

            curVisibleChunks.Clear();
        }
Ejemplo n.º 4
0
        public override void OnMapClosedClient()
        {
            foreach (MapComponent cmp in loadedMapData.Values)
            {
                cmp.Dispose();
            }

            loadedMapData.Clear();
            lock (chunksToGenLock)
            {
                chunksToGen.Clear();
            }
        }