public void WorldBuild() { for (int i = 0; i < players.Length; i++)//creates the player types and randomizes their positions { int unitType = r.Next(3); if (unitType == 0) { players[i] = new Ranged(r.Next(1, mapWidth), r.Next(0, mapHeight), teams[r.Next(2)]); // make a Ranged Boi } else if (unitType == 1) { players[i] = new Melee(r.Next(1, mapWidth), r.Next(0, mapHeight), teams[r.Next(2)]); // make a melee Boi } else { players[i] = new Wizzard(r.Next(1, mapWidth), r.Next(0, mapHeight), teams[2]); // make a wizard Boi } } for (int i = 0; i < buildings.Length; i++)//creates the building types and randomizes their positions { if (r.Next(2) == 0) { int yValue = r.Next(1, mapHeight); int SpawnVal; if (yValue == 0) { SpawnVal = -1; } else { SpawnVal = 1; } buildings[i] = new FactoryBuilding(r.Next(1, mapWidth), yValue, teams[r.Next(2)], SpawnVal);//make a factory } else { buildings[i] = new ResourceBuilding(r.Next(1, mapWidth), r.Next(0, mapHeight), teams[r.Next(2)]);//make a recource building } } UpdateWorld(); }
public void WorldBuild() { for (int i = 0; i < players.Length; i++)//creates the player types and randomizes their positions { if (r.Next(2) == 0) { players[i] = new Ranged(r.Next(1, mapSize), r.Next(0, mapSize), teams[r.Next(2)]); } else { players[i] = new Melee(r.Next(1, mapSize), r.Next(0, mapSize), teams[r.Next(2)]); } } for (int i = 0; i < buildings.Length; i++)//creates the player types and randomizes their positions { if (r.Next(2) == 0) { int yValue = r.Next(1, mapSize); int SpawnVal; if (yValue == 0) { SpawnVal = -1; } else { SpawnVal = 1; } buildings[i] = new FactoryBuilding(r.Next(1, mapSize), yValue, teams[r.Next(2)], SpawnVal); } else { buildings[i] = new ResourceBuilding(r.Next(1, mapSize), r.Next(1, mapSize), teams[r.Next(2)]); } } UpdateWorld(); }