示例#1
0
        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("");
        }
示例#2
0
        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));
            }
        }
示例#3
0
        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()));
            }
        }
示例#4
0
        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));
        }