/// <summary> /// Creates a new Tile without creating the Sprite /// </summary> /// <param name="tileSet">The TileSet that contains the tile image.</param> /// <param name="source">The source rectangle of the tile.</param> /// <param name="OriginalID">This Tile's ID</param> /// <param name="properties">The initial property collection or null to create an empty property collection.</param> internal Tile(TileSet tileSet, Rect source, int OriginalID, PropertyCollection properties, int mapTileWidth = 0) { this.OriginalID = OriginalID; CurrentID = OriginalID; TileSet = tileSet; Source = source; Properties = properties ?? new PropertyCollection(); Color = Color.white; SpriteEffects = new X_UniTMX.SpriteEffects(); if (mapTileWidth <= 0) { MapTileWidth = TileSet.TileWidth; } }
/// <summary> /// Creates a new Tile object. /// </summary> /// <param name="tileSet">The TileSet that contains the tile image.</param> /// <param name="source">The source rectangle of the tile.</param> /// <param name="OriginalID">This Tile's ID</param> /// <param name="properties">The initial property collection or null to create an empty property collection.</param> /// <param name="pivot">The Tile's Sprite Pivot Point</param> /// <param name="mapTileWidth">The Map's TileWidth this tile is inside, used to calculate sprite's pixelsToUnits</param> public Tile(TileSet tileSet, Rect source, int OriginalID, PropertyCollection properties, Vector2 pivot, int mapTileWidth = 0) { if (tileSet == null) throw new ArgumentNullException("tileSet"); this.OriginalID = OriginalID; CurrentID = OriginalID; TileSet = tileSet; Source = source; Properties = properties ?? new PropertyCollection(); Color = Color.white; SpriteEffects = new X_UniTMX.SpriteEffects(); MapTileWidth = mapTileWidth; if (mapTileWidth <= 0) MapTileWidth = TileSet.TileWidth; CreateSprite(pivot); }
/// <summary> /// Creates a new Tile object. /// </summary> /// <param name="tileSet">The TileSet that contains the tile image.</param> /// <param name="source">The source rectangle of the tile.</param> /// <param name="OriginalID">This Tile's ID</param> /// <param name="properties">The initial property collection or null to create an empty property collection.</param> /// <param name="pivot">The Tile's Sprite Pivot Point</param> /// <param name="mapTileWidth">The Map's TileWidth this tile is inside, used to calculate sprite's pixelsToUnits</param> public Tile(TileSet tileSet, Rect source, int OriginalID, PropertyCollection properties, Vector2 pivot, int mapTileWidth = 0) { if (tileSet == null) { throw new ArgumentNullException("tileSet"); } this.OriginalID = OriginalID; CurrentID = OriginalID; TileSet = tileSet; Source = source; Properties = properties ?? new PropertyCollection(); Color = Color.white; SpriteEffects = new X_UniTMX.SpriteEffects(); MapTileWidth = mapTileWidth; if (mapTileWidth <= 0) { MapTileWidth = TileSet.TileWidth; } CreateSprite(pivot); }
/// <summary> /// Creates a new Tile without creating the Sprite /// </summary> /// <param name="tileSet">The TileSet that contains the tile image.</param> /// <param name="source">The source rectangle of the tile.</param> /// <param name="OriginalID">This Tile's ID</param> /// <param name="properties">The initial property collection or null to create an empty property collection.</param> internal Tile(TileSet tileSet, Rect source, int OriginalID, PropertyCollection properties, int mapTileWidth = 0) { this.OriginalID = OriginalID; CurrentID = OriginalID; TileSet = tileSet; Source = source; Properties = properties ?? new PropertyCollection(); Color = Color.white; SpriteEffects = new X_UniTMX.SpriteEffects(); if (mapTileWidth <= 0) MapTileWidth = TileSet.TileWidth; }