Ejemplo n.º 1
0
 /// <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;
     }
 }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
 /// <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;
 }