| | |
| | |
|
| | | public static GameObject LoadUINPC(int id)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<NPCConfig>(id);
|
| | | var config = Config.Instance.Get<NPCConfig>(id);
|
| | | var model = GameObjectPoolManager.Instance.RequestNpcGameObject(id);
|
| | |
|
| | | if (!model && config.NPCType == (int)E_NpcType.Func)
|
| | |
| | | var animator = model.GetComponent<Animator>();
|
| | | if (animator != null)
|
| | | {
|
| | | ResetRealmBossAnimator(id, animator);
|
| | | animator.enabled = false;
|
| | | }
|
| | |
|
| | |
| | | else
|
| | | {
|
| | | GameObjectPoolManager.Instance.ReleaseDefaultFuncNPC(model);
|
| | | }
|
| | | }
|
| | |
|
| | | private static void ResetRealmBossAnimator(int _id, Animator animator)
|
| | | {
|
| | | var configs = Config.Instance.GetAllValues<RealmConfig>();
|
| | | var index = configs.FindIndex((x) =>
|
| | | {
|
| | | return x.BossID == _id;
|
| | | });
|
| | | if (index != -1)
|
| | | {
|
| | | var npcConfig = Config.Instance.Get<NPCConfig>(_id);
|
| | | if (npcConfig != null)
|
| | | {
|
| | | var runtimeController = AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerSuffix, npcConfig.MODE);
|
| | | if (runtimeController != null)
|
| | | {
|
| | | animator.runtimeAnimatorController = runtimeController;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | if (instance == null)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<TreasureConfig>(_id);
|
| | | var config = Config.Instance.Get<TreasureConfig>(_id);
|
| | | var prefab = UILoader.LoadPrefab(config.Model);
|
| | | instance = GameObject.Instantiate(prefab);
|
| | | treasureModels[_id] = instance;
|