public void SetWoods(ServerDispatcher disp) { SendData data = new SendData(); data.clientId = ""; for (int i = woodStart; i < woodEnd; i++) { for (int j = 0; j < width; j++) { data.position = Map.map.GetTileByMapCoordinates(j, i).LocalPosition; if (rnd.NextDouble() <= obstacleFrequency) { data.creating = "Rock"; disp.CreateAndSync(data); } if (rnd.NextDouble() <= emptyFrequency) { } else { data.creating = "Tree"; disp.CreateAndSync(data); } } } }
public void SetPlayer(ServerDispatcher disp, Player p, int playerNum, int maxPlayers) { SendData data = new SendData(); data.clientId = p.Owner.Name.Substring(6); PopulateInitialPosition initial = PopulateInitialPosition.GetPlayerPosition(playerNum, maxPlayers, width, height, castleWidth, castleHeight); int x = initial.x; int y = initial.y; data.position = Map.map.GetTileByMapCoordinates(x, y).LocalPosition; data.creating = "Castle"; disp.CreateAndSync(data); //create person data.creating = "Person"; for (int i = 0; i < personNum; i++) { data.position = Map.map.GetTileByMapCoordinates(x + i, y).LocalPosition; disp.CreateAndSync(data); } }
public void SetRiver(ServerDispatcher disp) { SendData data = new SendData(); data.clientId = ""; for (int i = (height - riverSize) / 2; i < (height + riverSize) / 2; i++) { for (int j = 0; j < width; j++) { data.position = Map.map.GetTileByMapCoordinates(j, i).LocalPosition; data.creating = "Water"; disp.CreateAndSync(data); } } }