Example #1
0
        private TileEntry AddTileEntry(Tile tile, int tileNumber, bool hFlip, bool vFlip)
        {
            int       hash  = tile.GetHashCode(hFlip, vFlip);
            TileEntry entry = new TileEntry(tileNumber, hFlip, vFlip);

            this.TileDictionary.Add(hash, entry);
            return(entry);
        }
Example #2
0
        /// <summary>
        /// Adds the specified tile to the tileset, even if an equivalent tile is already in the tileset.
        /// </summary>
        /// <param name="tile">The tile to add.</param>
        /// <returns>The created tile entry for the tile.</returns>
        public TileEntry AddTile(Tile tile, bool hFlip, bool vFlip)
        {
            int tileNum = this.Count;

            this.Tiles.Add(tile);

            TileEntry entry = this.AddTileEntry(tile, tileNum, false, false);

            if (hFlip)
            {
                this.AddTileEntry(tile, tileNum, true, false);
            }
            if (vFlip)
            {
                this.AddTileEntry(tile, tileNum, false, true);
            }
            if (hFlip && vFlip)
            {
                this.AddTileEntry(tile, tileNum, true, true);
            }

            return(entry);
        }