private bool ProcessTilesetElementInternal(XElement xTileset) { var firstId = xTileset.GetAttributeAs <int>("firstgid"); var name = xTileset.GetAttributeAs <string>("name"); var tileset = ScriptableObject.CreateInstance <SuperTileset>(); tileset.m_IsInternal = true; tileset.name = name; m_InternalTilesets.Add(tileset); string assetName = string.Format("_TilesetScriptObjectInternal_{0}", m_InternalTilesets.Count); SuperImportContext.AddObjectToAsset(assetName, tileset); // In the case of internal tilesets, only use an atlas if it will help with seams bool useAtlas = xTileset.Element("image") != null; var loader = new TilesetLoader(tileset, this, useAtlas, 1024, 1024); if (loader.LoadFromXml(xTileset)) { m_GlobalTileDatabase.RegisterTileset(firstId, tileset); ReportWarning("Tileset '{0}' is an embedded tileset. Exported tilesets are preferred.", tileset.name); return(true); } return(false); }
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); }