public void RegisterTileset(int firstId, SuperTileset tileset)
 {
     foreach (var tile in tileset.m_Tiles)
     {
         m_Tiles[firstId + tile.m_TileId] = tile;
     }
 }
 public AtlasBuilder(TiledAssetImporter importer, bool useSpriteAtlas, int atlasWidth, int atlasHeight, SuperTileset tilesetScript)
 {
     m_TiledAssetImporter = importer;
     m_UseSpriteAtlas     = useSpriteAtlas;
     m_AtlasWidth         = atlasWidth;
     m_AtlasHeight        = atlasHeight;
     m_TilesetScript      = tilesetScript;
 }
 public TilesetLoader(SuperTileset tileset, TiledAssetImporter importer, bool useAtlas, int atlasWidth, int atlasHeight)
 {
     m_TilesetScript  = tileset;
     m_Importer       = importer;
     m_UseSpriteAtlas = useAtlas;
     m_AtlasWidth     = atlasWidth;
     m_AtlasHeight    = atlasHeight;
 }
        private void CreateTileset(XElement xTileset)
        {
            Assert.IsNull(this.Tileset);

            Tileset = ScriptableObject.CreateInstance <SuperTileset>();
            Tileset.m_IsInternal = false;
            SuperImportContext.AddObjectToAsset("_TilesetScriptObject", Tileset, SuperImportContext.Icons.TsxIcon);
            SuperImportContext.SetMainObject(this.Tileset);

            var loader = new TilesetLoader(this.Tileset, this, m_UseSpriteAtlas, (int)m_AtlasWidth, (int)m_AtlasHeight);

            loader.LoadFromXml(xTileset);
        }
Beispiel #5
0
        public void RegisterTileset(int firstId, SuperTileset tileset)
        {
            foreach (SuperTile tile in tileset.m_Tiles)
            {
                int id = firstId + tile.m_TileId;
                m_Tiles[id] = tile;

                // keep track of tile if it has custom properties
                if (tile.m_CustomProperties != null && tile.m_CustomProperties.Count > 0)
                {
                    m_CustomTiles.Add(new IdSuperTilePair(id, tile));
                }
            }
        }