public LDtkLevelBackgroundBuilder(LDtkProjectImporter importer, GameObject levelTransform, LDtkSortingOrder layerSortingOrder, Level level, Vector2 worldSpaceSize)
 {
     _importer          = importer;
     _levelTransform    = levelTransform;
     _layerSortingOrder = layerSortingOrder;
     _level             = level;
     _worldSpaceSize    = worldSpaceSize;
 }
Example #2
0
        public LDtkJsonEditorCache(LDtkProjectImporter importer)
        {
            _assetPath = importer.assetPath;

            TryCreateKey(_assetPath);

            byte[] newHash = GetFileHash();

            //if the asset is null or check if the new hash is different from the last one, to update the json info for the editor. or if enforced
            if (ShouldDeserialize(newHash))
            {
                LdtkJson fromJson = null;
                try
                {
                    fromJson = importer.JsonFile.FromJson;
                }
                catch
                {
                    // ignored
                }

                GlobalCache[_assetPath] = new Cache()
                {
                    Hash = newHash,
                    Json = fromJson,
                    ShouldReconstruct = false
                };
            }

            if (GlobalCache[_assetPath] == null)
            {
                Debug.LogError("LDtk: A cached editor value is null, this should never be expected");
                return;
            }

            GlobalCache[_assetPath].ShouldReconstruct = false;
            Json = GlobalCache[_assetPath].Json;
        }
 public LDtkProjectImporterFactory(LDtkProjectImporter importer)
 {
     _importer = importer;
 }