Example #1
0
        private void CreateTile(TileType type, Vector2 position)
        {
            //sets tile with given position to given type

            if (position.X > mapSize
                || position.Y > mapSize)
            {
                return;
            }

            Tile til;
            switch (type)
            {
                case TileType.Grass:
                    til = new TileGrass(position);
                    break;
                case TileType.Rock:
                    til = new TileRock(position);
                    break;
                case TileType.Gravel:
                    til = new TileGravel(position);
                    break;
                case TileType.Water:
                    til = new TileWater(position);
                    break;
                default:
                    til = new TileGrass(position);
                    break;
            }

            int X = (int)position.X;
            int Y = (int)position.Y;

            TilesArray[X, Y] = til;
        }
Example #2
0
        //STILL IN DEVELOPMENT
        private void GenerateMap(int size)
        {
            //fills whole map with grass
            for (int i = 0; i < size + 1; i++)
            {
                //rows
                for (int j = 0; j < size + 1; j++)
                {
                    //cols
                    TilesArray[i, j] = new TileGrass(new Vector2(i, j));
                }
            }

            SetObjects();
        }