Example #1
0
 /// <summary>
 /// Constructor with layer size. Tiles are not initialized.
 /// </summary>
 /// <param name="tilesetName">The layer's tileset name</param>
 /// <param name="width">The layer width</param>
 /// <param name="height">The layer height</param>
 public Layer2D(string tilesetName, int width, int height)
 {
     _tilesetName = tilesetName;
     _tiles       = new Tile2D[width, height];
     _layerWidth  = width;
     _layerHeight = height;
 }
Example #2
0
		/// <summary>
		/// Constructor with layer size. Tiles are not initialized.
        /// </summary>
        /// <param name="tilesetName">The layer's tileset name</param>
		/// <param name="width">The layer width</param>
		/// <param name="height">The layer height</param>
		public Layer2D(string tilesetName, int width, int height)
		{
            _tilesetName = tilesetName;
			_tiles = new Tile2D[width,height];
			_layerWidth = width;
			_layerHeight = height;
		}
Example #3
0
 /// <summary>
 /// Create the layer from a raw data array containing tile IDs
 /// </summary>
 /// <param name="tilesetName">The layer's tileset name</param>
 /// <param name="data">the raw data</param>
 public Layer2D(string tilesetName, int[,] data)
     : this(tilesetName, data.GetUpperBound(1), data.GetUpperBound(0))
 {
     for (int x = 0; x < _layerWidth; x++)
     {
         for (int y = 0; y < _layerHeight; y++)
         {
             this[x, y] = new Tile2D(x, y, data[y, x]);
         }
     }
 }
Example #4
0
		/// <summary>
		/// Create the layer from a raw data array containing tile IDs
        /// </summary>
        /// <param name="tilesetName">The layer's tileset name</param>
		/// <param name="data">the raw data</param>
        public Layer2D(string tilesetName, int[,] data)
            : this(tilesetName, data.GetUpperBound(1), data.GetUpperBound(0))
		{
			for(int x = 0; x < _layerWidth; x++)
			{	
				for(int y = 0; y < _layerHeight; y++)
				{
					this[x, y] = new Tile2D(x, y, data[y, x]);
				}
			}
		}