Esempio n. 1
0
        /// <summary>
        /// Generate a map to be used with the given controller
        /// </summary>
        /// <param name="controller">The controller that will maintain the map</param>
        public override void GenerateMap(CoinController controller)
        {
            foreach (BaseTile tile in _tiles)
            {
                if (tile is Player)
                {
                    // Move the player tile
                    controller.Player.Top  = tile.Top;
                    controller.Player.Left = tile.Left;
                }
                else
                {
                    // Create a shallow copy of the instance
                    BaseTile t = (BaseTile)Activator.CreateInstance(tile.GetType());
                    t.Top  = tile.Top;
                    t.Left = tile.Left;

                    // Place the tile
                    controller.PlaceTile(t, true);
                }
            }
        }