Example #1
0
        protected virtual void Generate()
        {
            _tiles = new ITile[_width, _height];

            var dungeonMap = Generator.Generate(_width, _height, _mapGenConfig);

            for (int x = 0; x < _width; x++)
            {
                for (int y = 0; y < _height; y++)
                {
                    var cellType = dungeonMap[x, y].CellType;
                    if (cellType == Generator.CellType.Wall)
                    {
                        _tiles[x, y] = _container.Resolve <CobblestoneTile>();
                    }
                    else if (cellType == Generator.CellType.Room ||
                             cellType == Generator.CellType.Corridor)
                    {
                        if (SimplexNoise.Noise.Generate(x * 0.07f, y * 0.07f) > 0.5f - _rand.NextDouble())
                        {
                            _tiles[x, y] = _container.Resolve <GrassTile>();
                        }
                        else
                        {
                            _tiles[x, y] = _container.Resolve <DirtTile>();
                        }
                    }
                }
            }
        }
Example #2
0
 public TopLayer(ITile[,] tiles, ICharacter[,] characters, IPosition ExitingPosition, IPosition spawnPosition, IInteractiveObject[,] interactiveObjects)
     : base(tiles, characters, interactiveObjects)
 {
     this.spawnPosition   = spawnPosition;
     this.ExitingPosition = ExitingPosition;
     initializeDecendingStair();
 }
Example #3
0
        public Maze(int size)
        {
            this.size = size;
            tiles     = new AbstractTile[size, size];

            CreatePrimsMaze();
        }
Example #4
0
        public Board(IGameSettings gameSettings)
        {
            Grid = new Tile[gameSettings.BoardXSize, gameSettings.BoardYSize];

            //Initilize Grid
            var xLength = Grid.GetLength(0);
            var ylength = Grid.GetLength(1);

            for (int i = 0; i < xLength; i++)
            {
                for (int j = 0; j < ylength; j++)
                {
                    Grid[i, j] = new Tile();
                }
            }

            //Set Mines
            foreach (var minePoint in gameSettings.Mines)
            {
                Grid[minePoint.X, minePoint.Y].TileType = TileType.Mine;
            }

            //Set Exit
            Grid[gameSettings.Exit.X, gameSettings.Exit.Y].TileType = TileType.Exit;
        }
 public void setup()
 {
     tiles              = new ITile[maxWidth, maxHeight];
     characters         = new ICharacter[maxWidth, maxHeight];
     interactiveObjects = new IInteractiveObject[maxWidth, maxHeight];
     _uut = new DumbLayer(tiles, characters, interactiveObjects);
 }
Example #6
0
        public TestMap(int size)
        {
            TileSize = 5f;

            Tiles = new ITile[size, size];

            var r = new Random(3);


            for (var i = 0; i < size; i++)
            {
                for (var j = 0; j < size; j++)
                {
                    var a = r.Next(-1, 2);
                    var b = r.Next(-1, 2);
                    var c = r.Next(-1, 2);
                    var d = r.Next(-1, 2);


                    var c1 = new TestCorner(new Vect3(i * TileSize - (TileSize / 2f), j * TileSize - (TileSize / 2f), 0));
                    var c2 = new TestCorner(new Vect3(i * TileSize - (TileSize / 2f), j * TileSize + (TileSize / 2f), 0));
                    var c3 = new TestCorner(new Vect3(i * TileSize + (TileSize / 2f), j * TileSize + (TileSize / 2f), 0));
                    var c4 = new TestCorner(new Vect3(i * TileSize + (TileSize / 2f), j * TileSize - (TileSize / 2f), 0));

                    Tiles[i, j] = new TestTile(c1, c2, c3, c4);
                }
            }


            // Tiles[0, 0].C1.Height = -1;
            Tiles[0, 0].C2.Position += new Vect3(0, 0, 2);
            Tiles[0, 1].C1.Position += new Vect3(0, 0, 2);
        }
Example #7
0
        public SynchronizerFull(
            TileObject tempObject,
            List <Player> players,
            List <Objects.Actor> actors,
            List <Objects.ActiveDecoration> decorations,
            List <Objects.SpecEffect> effects,
            Objects.Tile[][] tiles,
            int randomCounter)
        {
            if (tempObject is Objects.Actor actor)
            {
                this.TempActor = actor.Id;
            }

            if (tempObject is Objects.ActiveDecoration decoration)
            {
                this.TempDecoration = decoration.Id;
            }

            this.RandomCounter      = randomCounter;
            this.Players            = players.Select(x => new SynchronizationObjects.Player(x));
            this.ChangedDecorations = decorations.Select(x => new ActiveDecoration(x));
            this.ChangedActors      = actors.Select(x => new Actor(x));
            this.ChangedEffects     = effects.Select(x => new SpecEffect(x));
            this.TileSet            = new ITile[tiles.Length, tiles[0].Length];
            for (int x = 0; x < tiles.Length; x++)
            {
                for (int y = 0; y < tiles[x].Length; y++)
                {
                    this.TileSet[x, y] = new Tile(tiles[x][y]);
                }
            }
        }
Example #8
0
        private void LoadPeopleFromFile()
        {
            JsonConverter[] converters = { new TileConverter() };
            LiveMap = JsonConvert.DeserializeObject <ITile[, ]>(File.ReadAllText(storagePathMap),
                                                                new JsonSerializerSettings()
            {
                Converters = converters
            });
            for (int x = 0; x < _cityWidth; x++)
            {
                for (int y = 0; y < _cityHeight; y++)
                {
                    if (LiveMap[x, y] is Home)
                    {
                        Home buffer = (Home)LiveMap[x, y];
                        _homes.Add(buffer);
                        LiveMap[x, y] = buffer;
                    }
                    else if (LiveMap[x, y] is Office)
                    {
                        Office buffer = (Office)LiveMap[x, y];
                        _offices.Add(buffer);
                        LiveMap[x, y] = buffer;
                    }
                    else if (LiveMap[x, y] is Intersection)
                    {
                        Intersection buffer = (Intersection)LiveMap[x, y];
                        _intersections.Add(buffer);
                        LiveMap[x, y] = buffer;
                    }
                }
            }

            _people = JsonConvert.DeserializeObject <List <Person> >(File.ReadAllText(storagePathPeople));
        }
Example #9
0
        public GameBoard(int width, int height)
        {
            // create board data
            Data = new ITile[width, height];
            rng  = new Random();

            // fill board with floor
            for (int y = 0; y < Data.GetLength(1); y++)
            {
                for (int x = 0; x < Data.GetLength(0); x++)
                {
                    Data[x, y] = new Tiles.Floor(x, y);
                    if (x == 0 || x == Data.GetLength(0) - 1 ||
                        y == 0 || y == Data.GetLength(1) - 1)
                    {
                        Data[x, y].EntityOnTile = new Entities.Wall(this, x, y);
                    }
                    else if (x != 1 || y != 1)
                    {
                        if (rng.NextDouble() < 0.025)
                        {
                            Data[x, y].EntityOnTile = new Entities.Treasure(this, x, y);
                        }
                        else if (rng.NextDouble() < 0.025)
                        {
                            Data[x, y].EntityOnTile = new Entities.Monster(this, x, y);
                        }
                    }
                }
            }
        }
Example #10
0
 public GameBoard()
 {
     this.gameBoard     = new ITile[NumberOfRows, NumberOfColumn];
     this.tileGenerator = new TileGenerator();
     this.hint          = new Hint();
     this.score         = new Score();
 }
Example #11
0
        public NextStepCommand GetNextStep(ITile[,] board)
        {
            var key = Console.ReadKey(true);

            switch (key.Key)
            {
            case ConsoleKey.UpArrow:
                return(NextStepCommand.Up);

            case ConsoleKey.DownArrow:
                return(NextStepCommand.Down);

            case ConsoleKey.LeftArrow:
                return(NextStepCommand.Left);

            case ConsoleKey.RightArrow:
                return(NextStepCommand.Right);

            case ConsoleKey.Q:
                return(NextStepCommand.Break);

            case ConsoleKey.Z:
                if ((key.Modifiers & ConsoleModifiers.Control) == ConsoleModifiers.Control)
                {
                    return(NextStepCommand.Break);
                }
                break;
            }
            return(NextStepCommand.Nop);
        }
        //public bool CheckHintWord(Word word, ITile[,] scrabbleTile = null)
        //{
        //    if (word.Direction == MovementDirection.None)
        //    {
        //        word.StartX = 7;
        //        word.StartY = 7;
        //        word.EndX = 7 + word.Text.Length;
        //        word.EndY = 7+1;
        //        word.Direction = MovementDirection.Across;
        //    }
        //    for (int i = 0; i < word.Text.Length; i++)
        //    {
        //        var tile = scrabbleTile[word.StartX + (word.Direction == MovementDirection.Across ? i : 0), word.StartY + (word.Direction == MovementDirection.Down ? i : 0)];

        //        if (tile.Text == "")
        //        {
        //            tile.Text = word.Text[i].ToString();
        //            tile.TileInPlay = true;
        //        }

        //    }
        //    //PrintGridConsole(scrabbleTile);
        //    var valid = ScrabbleForm.WordValidator.ValidateWordsInPlay(scrabbleTile).Valid;


        //    return valid;

        //}
        public bool SetHintWord(Word word, ITile[,] scrabbleTile = null)
        {
            if (word.Direction == MovementDirection.None)
            {
                word.StartTile.Ligne = 7;
                word.StartTile.Col   = 7;
                word.Direction       = MovementDirection.Across;
            }
            var tile = scrabbleTile[word.StartTile.Ligne, word.StartTile.Col];

            for (int i = 0; i < word.Text.Length; i++)
            {
                tile.Letter = Game.Alphabet.Find(c => c.Char == char.ToUpper(word.Text[i]));
                tile.Text   = char.IsLower(word.Text[i]) ? tile.Letter.Char.ToString().ToLower() : tile.Letter.Char.ToString();
                if (word.Direction == MovementDirection.Across)
                {
                    tile = scrabbleTile[word.StartTile.Ligne, word.StartTile.Col + i + 1];
                }
                else
                {
                    tile = scrabbleTile[word.StartTile.Ligne + i + 1, word.StartTile.Col];
                }
            }
            return(word.IsAllowed);
        }
Example #13
0
 protected Layer(ITile[,] tiles, ICharacter[,] characters, IInteractiveObject[,] interactiveObjects)
 {
     Tiles              = tiles;
     Characters         = characters;
     Width              = Tiles.GetLength(0);
     Height             = Tiles.GetLength(1);
     InteractiveObjects = interactiveObjects;
 }
Example #14
0
 public void Setup(int width, int height)
 {
     _boardWidth  = width;
     _boardHeight = height;
     _tiles       = new Tile[_boardWidth, _boardHeight];
     _currentTile = new FinishTile(0, 0);
     _finishTile  = new FinishTile(width == 0 ? 0 : 1, 0);
 }
Example #15
0
 public MiddelLayer(ITile[,] tiles, ICharacter[,] characters, IPosition ExitingPosition, IPosition EnteringPosition, IInteractiveObject[,] interactiveObjects)
     : base(tiles, characters, interactiveObjects)
 {
     this.ExitingPosition  = ExitingPosition;
     this.EnteringPosition = EnteringPosition;
     initializeAccendigStair();
     initializeDecendingStair();
 }
        public ITile GetPossibleTile(ITile[,] gameboard)
        {
            var possibleMoves = this.GetAllPossibleTiles(gameboard);
            var randomIndex   = this.random.Next(possibleMoves.Count());
            var possibleTile  = possibleMoves.ElementAt(randomIndex);

            return(possibleTile);
        }
Example #17
0
 public GameEngine(int rows, int columns, int numberOfMines)
 {
     this.rows = rows;
     this.columns = columns;
     this.numberOfMines = numberOfMines;
     squares = new Square[rows, columns];
     tiles = new ITile[rows,columns];
 }
Example #18
0
 public GameEngine(int rows, int columns, int numberOfMines)
 {
     this.rows          = rows;
     this.columns       = columns;
     this.numberOfMines = numberOfMines;
     squares            = new Square[rows, columns];
     tiles = new ITile[rows, columns];
 }
Example #19
0
        /// <summary>
        /// Setup board based on configuration passed
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="playerPosition"></param>
        public void Create(int width, int height, Position playerPosition)
        {
            Tiles           = new Tile[height, width];
            _creationWidth  = width;
            _creationHeight = height;

            Reset(playerPosition);
        }
 void Start()
 {
     buildings = new List <IBuilding>();
     //generate area
     tiles = new CreatePlacementArea().Generate(tileFactory, planeCollider, mapSettings.MapWidth, mapSettings.MapHight);
     //set tiles checker
     highlightTiles = new HighlightTiles(this);
 }
Example #21
0
 public ClientGameState(IGameState gameState)
 {
     Player                = gameState.Player;
     Tiles                 = gameState.Map.GetCurrentLayer().Tiles;
     Characters            = gameState.Map.GetCurrentLayer().Characters;
     InitialPlayerPosition = gameState.Map.GetCurrentLayer().getEnteringPositionOrNull();
     ExitPosition          = gameState.Map.GetCurrentLayer().getExitingPositionOrNull();
     InteractiveObjects    = gameState.Map.GetCurrentLayer().InteractiveObjects;
 }
Example #22
0
        public WorldSectionData(int width, int height)
        {
            Width  = width;
            Height = height;

            Signs      = new SignData[0];
            Chests     = new ChestData[0];
            ItemFrames = new ItemFrameData[0];
            Tiles      = new ITile[width, height];
        }
Example #23
0
 void SetAllAdjacentValues(ITile[,] boardTiles)
 {
     for (int y = 0; y < boardTiles.GetLength(0); y++)
     {
         for (int x = 0; x < boardTiles.GetLength(1); x++)
         {
             SetAdjacentValues(y, x, boardTiles, tile => tile.IsEmpty);
         }
     }
 }
Example #24
0
        public Room(int width, int height)
        {
            size      = new Coord(width, height);
            tileCount = width * height;
            center    = new Coord(width / 2, height / 2);

            tiles = new ITile[width, height];

            openTiles = new FisherYates.ShuffleList <Coord>(tileCount);
        }
Example #25
0
 //for testing purposes
 public void TestBoard(ITile[,] tiles, IInfo info, IRandomTest rnd, IProducerConsumerMessages <string> producerConsumer)
 {
     this.info             = info;
     this.tiles            = tiles;
     this.rnd              = rnd;
     randomOption          = RandomOption.Testing;
     this.producerConsumer = producerConsumer;
     aliveObjects          = new Dictionary <int, IDynamicObject>();
     ReadFolder();
 }
Example #26
0
 public World(int height, int width)
 {
     Height      = height;
     Width       = width;
     Tiles       = new ITile[width, height];
     BackTiles   = new ITile[width, height];
     Entities    = new List <IEntity>();
     Projectiles = new List <IProjectile>();
     Generate();
 }
 public static IEnumerable <ITile> Where(this ITile[,] matrix, Func <ITile, bool> equalityComparer)
 {
     foreach (var tile in matrix)
     {
         if (equalityComparer(tile))
         {
             yield return(tile);
         }
     }
 }
Example #28
0
 public Board(int dimentionX, int dimentionY)
 {
     Grid = new Tile[dimentionX, dimentionY];
     for (int i = 0; i < Grid.GetLength(1); i++)
     {
         for (int j = 0; j < Grid.GetLength(0); j++)
         {
             Grid[i, j] = new Tile();
         }
     }
 }
Example #29
0
 public IEnumerable <ITile> QueryMapPart(int x, int y, int width, int height)
 {
     ITile[,] area = this[x, y, width, height];
     for (int yy = 0; yy < height; yy++)
     {
         for (int xx = 0; xx < width; xx++)
         {
             yield return(area[xx, yy]);
         }
     }
 }
Example #30
0
 public GridMap(int sizeX, int sizeY)
 {
     tiles = new ITile[sizeX, sizeY];
     for (int i = 0; i < sizeX; i++)
     {
         for (int j = 0; i < sizeY; j++)
         {
             tiles[i, j] = new TileInternal(i, j, 0);
         }
     }
 }
Example #31
0
        public void Initialize()
        {
            _tiles       = new Tile[Rows, Columns];
            _gameEnd     = false;
            _gameStarted = false;

            ClearGameBoard();
            ResizeGameBoard();
            GenerateTiles();
            GenerateMines();
        }
Example #32
0
        private int Matches(ITile[,] tempGameBoard)
        {
            var matched = 0;
            var tiles   = new List <ITile>();

            for (var i = 0; i < tempGameBoard.GetLength(0); i++)
            {
                for (var j = 0; j < tempGameBoard.GetLength(1) - 2; j++)
                {
                    if (tempGameBoard[i, j].TileType == tempGameBoard[i, j + 1].TileType &&
                        tempGameBoard[i, j + 1].TileType == tempGameBoard[i, j + 2].TileType)
                    {
                        tiles.Add(tempGameBoard[i, j]);
                        tiles.Add(tempGameBoard[i, j + 1]);
                        tiles.Add(tempGameBoard[i, j + 2]);
                        var index = j + 2;
                        while (index < tempGameBoard.GetLength(1) - 2 &&
                               tempGameBoard[i, j].TileType == tempGameBoard[i, index].TileType)
                        {
                            tiles.Add(tempGameBoard[i, index]);
                            index++;
                        }
                        matched++;
                    }
                }
            }
            for (var i = 0; i < tempGameBoard.GetLength(0) - 2; i++)
            {
                for (var j = 0; j < tempGameBoard.GetLength(1); j++)
                {
                    if (tempGameBoard[i, j].TileType == tempGameBoard[i + 1, j].TileType &&
                        tempGameBoard[i + 1, j].TileType == tempGameBoard[i + 2, j].TileType)
                    {
                        tiles.Add(tempGameBoard[i, j]);
                        tiles.Add(tempGameBoard[i + 1, j]);
                        tiles.Add(tempGameBoard[i + 2, j]);
                        var index = i + 2;

                        while (index < tempGameBoard.GetLength(0) - 2 &&
                               tempGameBoard[i, j].TileType == tempGameBoard[index, j].TileType)
                        {
                            tiles.Add(tempGameBoard[index, j]);
                            index++;
                        }
                        matched++;
                    }
                }
            }
            foreach (var tile in tiles)
            {
                tile.TileType = TileType.Explosive;
            }
            return(matched);
        }
Example #33
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="tiles">A matrix with the type of tile for each position.</param>
        public Map(ITile[,] tiles)
        {
            this.tiles = tiles;
            this.size = this.tiles.GetLength(0);

            // Initializes the matrix of units:
            units = new List<IUnit>[size, size];
            for(int x=0; x<this.size; x++) {
                for(int y=0; y<this.size; y++) {
                    units[x, y] = new List<IUnit>();
                }
            }
        }
Example #34
0
        public City(StartingValues startValues)
        {
            storagePathPeople = startValues.StoragePath;
            storagePathMap = startValues.StoragePathMap;

            mManager = new TrafficMutator();
            _budget = startValues.Budget;
             _traffictCycleTime = startValues.TrafficLightCycleTimeDefault;
            _cityHeight = startValues.MapHeight;
            _cityWidth = startValues.MapWidth;
            _population = startValues.Population;
            _zoning = new ZoneMap(_cityWidth,_cityHeight);

            LiveMap = new ITile[_cityWidth, _cityHeight];

            TravelTimes = new int[_cityWidth, _cityHeight];

            if (File.Exists(storagePathPeople))
            {
                //GeneratePeople();
                LoadPeopleFromFile();

            }
            else
            {
                _zoning = GenerateZones(_zoning);
                LiveMap = GenerateLiveMap(LiveMap);
                GenerateTravelTimeHelper();
                GeneratePeople();
            }

            PrintCity();
            //The larger the number the more accurate the final prediction
            while (mManager.GetNumberOfCyclesSinceLastKeptChange() < 200000)
             {
                 Tick();
             }

             Console.Out.WriteLine("The ideal intersection timing for this city is... [Measured in ticks]");
            PrintFinalOutput();
        }
Example #35
0
File: Level.cs Project: gmich/Snake
        public Level(ILevelProvider levelProvider, Action next, Action restart)
        {
            this.levelProvider = levelProvider;
            grid = levelProvider.Grid;
            levelSettings = levelProvider.LevelSettings;
            adjustmentRules = AdjustmentRules.Default(levelProvider.LevelSettings.HorizontalTileCount - 1,
                                                           levelProvider.LevelSettings.VerticalTileCount - 1);

            context = new LevelContext(levelProvider.Head,
                                       levelProvider.LevelSettings,
                                       levelProvider.TailSpawner,
                                       Direction.Left,
                                       restart,
                                       next,
                                       location =>
                                       {
                                           bool intersects = grid[(int)location.X, (int)location.Y].Collide();
                                           elements.ForEach(element => intersects|= element.Intersects(location));
                                           return intersects;
                                       },
                                       levelProvider.LevelSettings.MaxLives);
            elements.Add(levelProvider.Head);
        }
Example #36
0
 public void SetData(ITile[,] tiles)
 {
     _tiles = tiles;
     _xUpperBound = _tiles.GetUpperBound(0);
     _yUpperBound = _tiles.GetUpperBound(1);
 }
Example #37
0
        /* load the level map from file - for now just load a dummy level with random tile types */
        protected void Initialize(string filename, ArrayList tileTextures)
        {
            background = new Tile[32, 100];

            int screenWidth = Game.GraphicsDevice.Viewport.Width;
            int screenHeight = Game.GraphicsDevice.Viewport.Height;

            pixelOffset = 0;
            maxPixelOffset = (100 * (screenWidth / 64)) - screenWidth;
            minPixelOffset = 0;

            Random rand = new Random();

            for (int i = 0; i < 32; i++)
            {
                for (int j = 0; j < 100; j++)
                {
                    CollisionType colType = CollisionType.platform;
                    /*
                    switch (rand.Next(3))
                    {
                        case 0:
                            colType = CollisionType.passable;
                            break;
                        case 1:
                            colType = CollisionType.impassable;
                            break;
                        case 2:
                            colType = CollisionType.platform;
                            break;
                    }
                    */

                    if (31 == i || (29 == i && 51 < j) || (30 == i && j > 50))
                    {
                        colType = CollisionType.platform;
                    }
                    else if (99 == j || 0 == j)
                    {
                        colType = CollisionType.impassable;
                    }
                    else
                    {
                        colType = CollisionType.passable;
                    }
                    background[i, j] = new Tile((Texture2D)tileTextures[0], colType, j, i, screenWidth, screenHeight);
                }
            }
        }
Example #38
0
 /// <summary>
 /// Constructor for the deserialization.
 /// </summary>
 /// <param name="info">Information for the serialization.</param>
 /// <param name="context">The context for the serialization.</param>
 public Map(SerializationInfo info, StreamingContext context)
 {
     this.size = (int)info.GetValue("Size", typeof(int));
     this.units = (List<IUnit>[,])info.GetValue("Units", typeof(List<IUnit>[,]));
     this.tiles = (ITile[,])info.GetValue("Tiles", typeof(ITile[,]));
 }
Example #39
0
        /* load the level map from file - for now just load a dummy level with random tile types */
        protected void Initialize(int[,] mapLayout, ArrayList tileTextures, int bgIndex, int levelNum)
        {
            tiles = new Tile[mapLayout.GetLength(0), mapLayout.GetLength(1)];

            screenWidth = Game.GraphicsDevice.Viewport.Width;
            screenHeight = Game.GraphicsDevice.Viewport.Height;

            // hardcoded for now until we set up the file read
            background = (Texture2D)tileTextures[bgIndex];
            bgPosition.X = 0;
            bgPosition.Y = 0;
            bgPosition.Width = screenWidth;
            bgPosition.Height = screenHeight;

            pixelOffset = 0;
            maxPixelOffset = (mapLayout.GetLength(1) * (screenWidth / colsPerScreen)) - screenWidth;
            minPixelOffset = 0;

            int spriteIndex = outsideIndex;

            if (levelNum >= 3)
            {
                spriteIndex = castleIndex;
            }

            for (int j = 0; j < mapLayout.GetLength(1); j++)
            {
                for (int i = 0; i < mapLayout.GetLength(0); i++)
                {
                    tiles[i, j] = new Tile(Game, (Texture2D)tileTextures[spriteIndex], (CollisionType)mapLayout[i,j], j, i, screenWidth, screenHeight, rowsPerScreen, colsPerScreen);
                }
            }
        }
Example #40
0
        private void LoadPeopleFromFile()
        {
            JsonConverter[] converters = {new TileConverter()};
            LiveMap = JsonConvert.DeserializeObject<ITile[,]>(File.ReadAllText(storagePathMap),
                new JsonSerializerSettings() {Converters = converters});
            for (int x = 0; x < _cityWidth; x++)
            {
                for (int y = 0; y < _cityHeight; y++)
                {
                    if (LiveMap[x, y] is Home)
                    {
                         Home buffer = (Home)LiveMap[x, y];
                         _homes.Add(buffer);
                         LiveMap[x, y] = buffer;
                    } else if (LiveMap[x, y] is Office)
                    {
                        Office buffer = (Office)LiveMap[x, y];
                        _offices.Add(buffer);
                        LiveMap[x, y] = buffer;
                    }
                    else if (LiveMap[x, y] is Intersection)
                    {
                        Intersection buffer = (Intersection)LiveMap[x, y];
                        _intersections.Add(buffer);
                        LiveMap[x, y] = buffer;
                    }
                }
            }

            _people = JsonConvert.DeserializeObject<List<Person>>(File.ReadAllText(storagePathPeople));
        }
		/// <summary>
		/// Initializes a new instance with the specified collection
		/// as the underlying source.
		/// </summary>
		/// <param name="collection"></param>
		protected DefaultTileCollection(ITile[,] collection)
		{
			_tiles = collection;
		}