public void UpdateMap(UnitAndBuildingManager manager) //passes manager class { for (int y = 0; y < height; y++) //height and width instead of y and x in all code { for (int x = 0; x < width; x++) { map[x, y] = " "; } } foreach (Unit unit in manager.Units) { if (unit.IsVisible) //if visible, draw it. After a while, dead things disappear { map[unit.X, unit.Y] = unit.Symbol + "|" + unit.Faction[0]; } } foreach (Building building in manager.Buildings) { if (building.IsVisible) { map[building.X, building.Y] = building.Symbol + "|" + building.Faction[0]; } } }
public void UpdateMap(UnitAndBuildingManager manager) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { map[x, y] = " "; } } foreach (Unit unit in manager.Units) { if (unit.IsVisible) { map[unit.X, unit.Y] = unit.Symbol + "|" + unit.Faction[0]; } } foreach (Building building in manager.Buildings) { if (building.IsVisible) { map[building.X, building.Y] = building.Symbol + "|" + building.Faction[0]; } } }
public void UpdateMap(UnitAndBuildingManager manager) //manages all units and buildings { for (int y = 0; y < height; y++) { //height for y, width for x. map SIZE has been replaced for (int x = 0; x < width; x++) { map[x, y] = " "; //if the unit / building is visible, draw it. Cleans map of dead units } } foreach (Unit unit in manager.Units) { //each of these is singular purpose. One for unit, one for building if (unit.IsVisible) { map[unit.X, unit.Y] = unit.Symbol + "|" + unit.Faction[0]; } } foreach (Building building in manager.Buildings) { if (building.IsVisible) { map[building.X, building.Y] = building.Symbol + "|" + building.Faction[0]; } } }
public void Reset(int width, int height) { map = new Map(width, height); manager = new UnitAndBuildingManager(); CreateUnitsAndBuildings(); map.UpdateMap(manager); isGameOver = false; round = 0; }
public void LoadGame() { LoadSettings(); map = new Map(loadedMapWidth, loadedMapHeight); manager = new UnitAndBuildingManager(); foreach (string faction in factions) { manager.AddFaction(faction); } Load(UNITS_FILENAME); Load(BUIDLINGS_FILENAME); map.UpdateMap(manager); }
public void UpdateMap(UnitAndBuildingManager manager) { }