/// <summary> /// Retrieves a tile at position X and Y. /// </summary> /// <param name="x">The X coordinate of the tile to retrieve</param> /// <param name="y">The Y coordinate of the tile to retrieve</param> /// <returns> /// A Terraria.Tile instance of the tile at position X and Y. /// </returns> /// <remarks> /// Virtual function that derivatives must override if they want to implement getting of a tile from /// its backing store. /// </remarks> protected virtual Terraria.Tile GetTile(int x, int y) { HeapTile tile; lock (syncRoot) { if (lastTile != null && x == lastTile.x && y == lastTile.y) { return(lastTile); } tile = lastTile = new HeapTile(tileHeap, x, y); } return(tile); }
/// <summary> /// Sets a tile at position X and Y to the tile instance specified. /// </summary> /// <param name="tile"> /// A tile instance in which to store /// </param> /// <param name="x">X coordinate of the tile to store</param> /// <param name="y">Y coordinate of the tile to store</param> /// <remarks> /// Virtual function that derivatives must override if they want to implement getting of a tile from /// its backing store. /// </remarks> protected virtual void SetTile(Terraria.Tile tile, int x, int y) { HeapTile heapTile = new HeapTile(tileHeap, x, y); heapTile.CopyFrom(tile); }
/// <summary> /// Sets a tile at position X and Y to the tile instance specified. /// </summary> /// <param name="tile"> /// A tile instance in which to store /// </param> /// <param name="x">X coordinate of the tile to store</param> /// <param name="y">Y coordinate of the tile to store</param> /// <remarks> /// Virtual function that derivatives must override if they want to implement getting of a tile from /// its backing store. /// </remarks> protected virtual void SetTile(Terraria.Tile tile, int x, int y) { HeapTile heapTile = new HeapTile(tileHeap, x, y); heapTile.CopyFrom(tile); }