private void OnDestroy() { #if !UNITY_EDITOR try { #endif if (hasRemoveBinding == false) { RemoveBindEvent(); } hasRemoveBinding = true; if (AnimModelRoot) { AnimModelRoot.DestroyModel(); } #if !UNITY_EDITOR } catch (Exception ex) { Logger.Error(ex.ToString()); } #endif }
//-----------------------------------------------Model----- private void DestroyModel() { if (WingModel) { WingModel.DestroyModel(); } }
private void DestroyModel() { if (Model != null) { Model.RemoveAllCompent(); Model.DestroyModel(); } if (EquipModel != null) { EquipModel.RemoveAllCompent(); EquipModel.DestroyModel(); } if (effectCoroutine != null) { StopCoroutine(effectCoroutine); effectCoroutine = null; } if (ModelRoot != null) { ModelRoot.DestroyFakeCharacter(); } }
private void CreateFakeObj(IEvent ievent) { int dataId = (ievent as MountRefreshModel_Event).MountId; if (ModelRoot) { ModelRoot.DestroyModel(); } var tbEquip = Table.GetEquipBase(dataId); if (tbEquip == null) { return; } var tbMont = Table.GetWeaponMount(tbEquip.EquipModel); if (tbMont == null) { return; } StartCoroutine(CreateModelCoroutine(() => { ModelRoot.DestroyModel(); ModelRoot.CreateModel(tbMont.Path, tbEquip.AnimPath + "/Stand.anim", model => { ModelDrag.Target = model.transform; ModelRoot.PlayAnimation(); model.gameObject.SetLayerRecursive(LayerMask.NameToLayer(GAMELAYER.UI)); model.gameObject.SetRenderQueue(RenderQueue); var particle = model.gameObject.GetComponent <ParticleScaler>(); if (particle != null) { particle.Update(); } ModelDrag.Target.gameObject.SetActiveRecursive(true); }, false); })); }