private string buildBuildings(PositionModel[] buildingPosition, char[] symbol, int xCord, int yCord) { for (int count = 0; count < buildingPosition.Length; count++) { PositionModel positionModel = buildingPosition[count]; if (xCord == positionModel.XPosition && yCord == positionModel.YPosition) { return(symbol[count].ToString()); } } return(""); }
private Building createRandomBuilding() { int randomNumber = randomizer.Next(0, 2); PositionModel unitPosition = new PositionModel(generateRandomUnitPosition(), generateRandomUnitPosition()); if (randomNumber == 1) { return(new ResourceBuilding(unitPosition.XPosition, unitPosition.YPosition, generateBuildingTeamName(), generateResourceType())); } else { return(new FactoryBuilding(unitPosition.XPosition, unitPosition.YPosition, generateBuildingTeamName(), MAP_SIZE)); } }
private Unit createRandomUnit() { int randomNumber = randomizer.Next(0, 2); PositionModel unitPosition = new PositionModel(generateRandomUnitPosition(), generateRandomUnitPosition()); if (randomNumber == 1) { return(new MeleeUnit(unitPosition.XPosition, unitPosition.YPosition, TEAM_1_NAME, generateMeleeUnitName())); } else { return(new RangedUnit(unitPosition.XPosition, unitPosition.YPosition, TEAM_2_NAME, generateRangedUnitName())); } }
public void displayUnitsOnBattlefield() { int[][] unitLayout = new int [unitList.Length][]; char[] unitSymbol = new char [unitList.Length]; for (int count = 0; count < unitList.Length; count++) { Unit unit = unitList[count]; unitLayout[count] = unit.returnPosition(); unitSymbol[count] = unit.returnSymbol(); } PositionModel[] buildingPositions = new PositionModel[buildingList.Length]; char[] buildingSymbol = new char [buildingList.Length]; for (int count = 0; count < buildingPositions.Length; count++) { Building building = buildingList[count]; buildingPositions[count] = building.returnPosition(); buildingSymbol[count] = building.returnSymbol(); } view.invalidateView(buildBattleField(unitLayout, buildingPositions, unitSymbol, buildingSymbol)); }