Ejemplo n.º 1
0
 public MapObject(Tile[,] tiles)
     : base(tiles)
 {
     // Set up any mouse related event handlers
     eventHandlers.Add(MouseButton.PressedEvent.Subscribe(TheMouse.Instance().LeftButton, new MouseButtonChanged(MouseClicked)));
 }
Ejemplo n.º 2
0
 public TileMap(Tile[,] tiles)
 {
     map = tiles;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts the static map int index to Tile objects
        /// </summary>
        /// <returns></returns>
        private Tile[,] GetTiles()
        {
            int width = map.GetLength(0),
                height = map.GetLength(1);

            Tile[,] tiles = new Tile[width, height];

            for (int row = 0; row < map.GetLength(0); row++)
            {
                for (int col = 0; col < map.GetLength(1); col++)
                {
                    Tile t = new Tile();
                    t.TextureIndex = map[row, col];
                    tiles[row, col] = t;
                }
            }

            return tiles;
        }