internal void update(Server server) { foreach (ServerEntity e in entityList.Values) { e.update(this); } bool c = entityAddList.Count > 0 || entityRemoveList.Count > 0; if (c) { while (entityAddList.Count > 0) { if (!entityList.ContainsKey(entityAddList[0].entityId)) { entityList.Add(entityAddList[0].entityId, entityAddList[0]); } else { server.println("Can't add: " + entityAddList[0].entityId); } entityAddList.RemoveAt(0); } while (entityRemoveList.Count > 0) { entityList.Remove(entityRemoveList[0]); entityRemoveList.RemoveAt(0); } entityArray = new ServerEntity[entityList.Count]; entityList.Values.CopyTo(entityArray, 0); } }
public ServerWorld(int width, int height, Server server) { wallGrid = new byte[width, height]; this.width = width; this.height = height; this.server = server; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Server form = new Server(); Application.Idle += new EventHandler(form.update); Application.Run(form); }
internal void update(Server server) { foreach(ServerWorld w in worlds.Values){ w.update(server); } }
internal void genWorld(int worldId, Server server) { if (worlds.ContainsKey(worldId)) { worlds.Remove(worldId); } worlds.Add(worldId, new ServerWorld(100, 100, server)); worlds[worldId].gen(); }
public WorldManager(Server server) { }