Example #1
0
 private static void InitStaticTools(LDtkDataProject project)
 {
     LDtkProviderTile.Init();
     LDtkProviderTilesetSprite.Init();
     LDtkProviderEnum.Init();
     LDtkProviderUid.CacheUidData(project);
     LDtkProviderErrorIdentifiers.Init();
 }
Example #2
0
 private static void DisposeStaticTools()
 {
     LDtkProviderTile.Dispose();
     LDtkProviderTilesetSprite.Dispose();
     LDtkProviderEnum.Dispose();
     LDtkProviderUid.Dispose();
     LDtkProviderErrorIdentifiers.Dispose();
 }
Example #3
0
        private static Sprite GetTileFromTileset(Sprite tileset, Vector2Int sourceCathodeRayPos, int pixelsPerUnit)
        {
            Debug.Assert(pixelsPerUnit != 0);

            sourceCathodeRayPos = LDtkToolOriginCoordConverter.ConvertPixel(sourceCathodeRayPos, tileset.texture.height, pixelsPerUnit);

            Vector2Int tileSize = Vector2Int.one * pixelsPerUnit;
            Rect       rect     = new Rect(sourceCathodeRayPos, tileSize);

            return(LDtkProviderTilesetSprite.GetSpriteFromTilesetAndRect(tileset, rect, pixelsPerUnit));
        }