using System; using System.Collections; using UnityEngine; public class ModelBuilder : MonoBehaviour { public static ModelBuilder _mainInstance; public static ModelBuilder GetInstance() { return _mainInstance; } public static T GetInstance() where T : ModelBuilder { return _mainInstance as T; } protected virtual void Awake() { _mainInstance = this; } public ObjectContainer SpawnAsset(string assetPath) { return SpawnAsset(AssetTypes.Unknown, assetPath); } public virtual ObjectContainer SpawnAsset(Enum assetType, string assetPath) { if (this.GetType() == typeof(ModelBuilder)) throw new NotImplementedException(); ModelViewerMain.GetInstance().PrepareForLoad(); return null; } public IEnumerator SpawnAssetCoroutine(string assetPath, Action callback = null) { yield return SpawnAssetCoroutine(AssetTypes.Unknown, assetPath, callback); } public virtual IEnumerator SpawnAssetCoroutine(Enum assetType, string assetPath, Action callback = null) { if(this.GetType() == typeof(ModelBuilder)) throw new NotImplementedException(); ModelViewerMain.GetInstance().PrepareForLoad(); yield break; } public virtual ObjectContainer SpawnSerialized(ObjectContainerSerializable oc) { if (this.GetType() == typeof(ModelBuilder)) throw new NotImplementedException(); ModelViewerMain.GetInstance().PrepareForLoad(); return null; } public virtual IEnumerator SpawnSerializedCoroutine(ObjectContainerSerializable oc, Action callback = null) { if (this.GetType() == typeof(ModelBuilder)) throw new NotImplementedException(); ModelViewerMain.GetInstance().PrepareForLoad(); yield break; } }