/// Author:	Guy Spronck
        /// Date:	04-06-2015
        /// <summary>
        /// Generates the map with the Tile object.
        /// </summary>
        /// <returns>Tuple containing Spawn, Tilemap</returns>
        /// <param name="stringLvl">String array for roadmap</param>
        /// <param name="stringGraphicLvl">String array for graphic layer</param>
        /// <param name="mapVariables">Variables of the map.</param>
        private static Tuple<Spawn, Tile[, ]> GenerateTileMap(string[,] stringLvl, string[,] stringGraphicLvl, MapVariables mapVariables)
        {
            int spawnX = 0, spawnY = 0;
            var lvl = new Tile[mapVariables.height, mapVariables.width];
            for (int iX = 0; iX < mapVariables.height; iX++) {
                for (int iY = 0; iY < mapVariables.width; iY++) {

                    if (stringLvl [iX, iY].Contains ((mapVariables.firstGidRoadmap+5).ToString())) {
                        spawnX = iY;
                        spawnY = iX;
                    }

                    lvl [iX, iY] = new Tile (checkNorthTile(iX,iY,stringLvl),
                        checkEastTile(iX,iY,stringLvl,mapVariables.width),
                        checkSouthTile(iX,iY,stringLvl,mapVariables.height),
                        checkWestTile(iX,iY,stringLvl),
                        checkShop(iX,iY,stringLvl,mapVariables.firstGidRoadmap),
                        Convert.ToInt32(stringGraphicLvl[iX,iY]) - mapVariables.firstGidGraphic);
                }
            }
            return Tuple.Create (new Spawn(spawnX,spawnY), lvl);
        }
Beispiel #2
0
 private void GenerateHardMap()
 {
     map = new Tile[7, 7];
 }
Beispiel #3
0
        private void GenerateMediumMap()
        {
            map = new Tile[5, 5];

            //TO-DO: Create a medium sized maps
        }
Beispiel #4
0
        private void GenerateEasyMap()
        {
            map = new Tile[3, 3];

            // y, x - north, east, south, west
            map [0, 0] = new Tile (false, true, false, false, EShops.None, 0);
            map [0, 1] = new Tile (false, false, true, true, EShops.None,0);
            map [0, 2] = new Tile (false, false, false, false, EShops.None,0);
            map [1, 0] = new Tile (false, false, false, false, EShops.None,0);
            map [1, 1] = new Tile (true, false, true, false, EShops.None,0);
            map [1, 2] = new Tile (false, false, false, false, EShops.None,0);
            map [2, 0] = new Tile (false, true, false, false, EShops.Butcher,0);
            map [2, 1] = new Tile (true, true, false, true, EShops.None,0);
            map [2, 2] = new Tile (false, false, false, true, EShops.Greengrocer,0);

            spawn = new Spawn (0, 0);
            cabbagesToRetreive = 1;
            sausagesToRetreive = 1;
            Robot robot = Robot.Create (EOrientation.East, this);
        }