using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; public class DanMachiModelBuilder : ModelBuilder { public static DanMachiModelBuilder Instance => GetInstance(); public override IEnumerator SpawnAsset(Enum assetType, string assetPath, Action callback = null) { switch (assetType) { case AssetTypes.Unknown: throw new NotImplementedException(); case AssetTypes.Character: var asset = DanMachiAssetLibrary.Instance.Characters.First(c=>c.AssetName == assetPath); callback?.Invoke(SpawnCharacter(asset)); break; default: throw new NotImplementedException(); } yield break; } public DanMachiCharacterContainer SpawnCharacter(CharacterAsset asset) { var container = ObjectContainer.Create("Character"); var handle = UIHandle.CreateAsChild(container.transform).Init(container); container.Build(asset); container.PlayAnimation(container.Animations[0]); return container; } }