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); } }
/// <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(); }
public override void OnMapClosedClient() { lock (chunksToGenLock) { chunksToGen.Clear(); } curVisibleChunks.Clear(); }
public override void OnMapClosedClient() { foreach (MapComponent cmp in loadedMapData.Values) { cmp.Dispose(); } loadedMapData.Clear(); lock (chunksToGenLock) { chunksToGen.Clear(); } }