private IEnumerator DoLoad(int npc_model_id, int layer, bool need_shadow, bool enable_light_probes, SHADER_TYPE shader_type, Action callback) { loadingQueue = new LoadingQueue(this); string model_name = ResourceName.GetNPCModel(npc_model_id); LoadObject lo_model = loadingQueue.LoadAndInstantiate(RESOURCE_CATEGORY.NPC_MODEL, model_name); string anim_name = ResourceName.GetNPCAnim(npc_model_id); LoadObject lo_anim = loadingQueue.Load(RESOURCE_CATEGORY.NPC_ANIM, anim_name, new string[1] { anim_name + "Ctrl" }, false); if (loadingQueue.IsLoading()) { yield return((object)loadingQueue.Wait()); } model = lo_model.Realizes(this.get_transform(), layer); if (model != null) { head = Utility.Find(model, "Head"); facial = model.GetComponentInChildren <NPCFacial>(); if (facial != null) { facial.animNode = Utility.Find(model, "Face"); } animator = model.GetComponentInChildren <Animator>(); if (lo_anim != null && animator != null) { animator.set_runtimeAnimatorController(lo_anim.loadedObjects[0].obj as RuntimeAnimatorController); } } PlayerLoader.SetLightProbes(model, enable_light_probes); renderers = model.GetComponentsInChildren <Renderer>(); int j = 0; for (int i = renderers.Length; j < i; j++) { if (renderers[j] is SkinnedMeshRenderer) { (renderers[j] as SkinnedMeshRenderer).set_localBounds(BOUNDS); } } switch (shader_type) { case SHADER_TYPE.LIGHTWEIGHT: ShaderGlobal.ChangeWantLightweightShader(renderers); break; case SHADER_TYPE.UI: ShaderGlobal.ChangeWantUIShader(renderers); break; } if (need_shadow) { shadow = PlayerLoader.CreateShadow(this.get_transform(), true, -1, shader_type == SHADER_TYPE.LIGHTWEIGHT); } coroutine = null; callback?.Invoke(); }