private void OnWeaponSuccess() { if (mVisual == null || mVisual.Visual == null || mPreviewRoot == null) { return; } if (mWeapon == null || !mWeapon.IsCompleteOrDestroy) { return; } mVisual.VisualTransform.parent = mPreviewRoot.transform; WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem; Transform bone = mVisual.GetBoneByName(mWeaopnRes.mountpoint); if (bone == null) { bone = mVisual.VisualTransform; } mWeapon.Visual.layer = layermask; Renderer[] renders = mWeapon.Visual.GetComponentsInChildren <Renderer>(); foreach (Renderer rd in renders) { rd.gameObject.layer = layermask; Material mtl = new Material(Shader.Find("Fantasy/ui/weapon")); mtl.mainTexture = rd.material.mainTexture; if (rd.material.shader.name == "FantasyEngine/weapon/environment") { mtl.SetTexture("_HightLightTex", rd.material.GetTexture("_HightLightTex")); } rd.material = mtl; } string animname = AnimationNameDef.GetAnimNameByStatename(mWeaopnRes.ani_pre, AnimationNameDef.PrefixXiuxi); PlayAnimaton(animname); //武器切换成功展现武器 if (DataManager.ShowWeaponTable.ContainsKey(mWeaopnRes.id)) { ShowWeaponItem showres = DataManager.ShowWeaponTable[mWeaopnRes.id] as ShowWeaponItem; ProcessWeaponShow(showres); } }
public uint AttachEffect(int id, string mountname) { if (!DataManager.EffectTable.ContainsKey(id)) { return(uint.MaxValue); } EffectTableItem effectitem = DataManager.EffectTable[id] as EffectTableItem; bool nullmount = string.IsNullOrEmpty(mountname); MeshVisual attachparent = mVisual; if (!nullmount) { if (mountname[0] == '%') { attachparent = mWeapon; } mountname = mountname.Substring(1); } Transform bone = attachparent.GetBoneByName(mountname); if (bone == null) { bone = attachparent.VisualTransform; } TransformData trans = new TransformData(); trans.Scale = Vector3.one * effectitem.scale; trans.notFollow = effectitem.notFollow; return(SceneManager.Instance.GetCurScene().GetParticleManager().AddParticle(effectitem.effect_name, effectitem.loop, bone, trans, effectitem.limitry)); }
private void OnWeaponSuccess() { if (mVisual == null || mVisual.Visual == null) { return; } if (mWeapon == null || !mWeapon.IsCompleteOrDestroy) { return; } WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem; Transform bone = mVisual.GetBoneByName(mWeaopnRes.mountpoint); if (bone == null) { bone = mVisual.VisualTransform; } string animname = AnimationNameDef.GetAnimNameByStatename(mWeaopnRes.ani_pre, AnimationNameDef.PrefixXiuxi); PlayAnimaton(animname); AttachMent attachment = mAttachMents[(int)AttachMountType.Weapon]; if (attachment == null) { return; } if (mWeaopnRes.weapon_buff != uint.MaxValue) { SkillBuffTableItem sbt = DataManager.BuffTable[mWeaopnRes.weapon_buff] as SkillBuffTableItem; if (sbt != null) { ParticleUtility.AddEffect2MV(mWeapon, (int)sbt._3DEffectID, sbt._3DEffectBindpoint, ParticleMng); } } }
virtual public Transform GetBoneTransofrm(string bonename) { if (string.IsNullOrEmpty(bonename)) { return(null); } if (mVisual == null || mVisual.Visual == null) { return(null); } Transform t = mVisual.GetBoneByName(bonename); if (t == null) { GameDebug.LogError(dbgGetIdentifier() + " 未在角色模型上找到骨骼" + bonename); } return(t); }
public static uint AddEffect2MV(MeshVisual visual, int effectid, string mount, SceneParticleManager mng) { if (!DataManager.EffectTable.ContainsKey(effectid)) { return(uint.MaxValue); } if (!string.IsNullOrEmpty(mount)) { mount = mount.Replace("%", ""); } EffectTableItem item = DataManager.EffectTable[effectid] as EffectTableItem; if (item == null) { return(uint.MaxValue); } Transform trans = visual.GetBoneByName(mount); if (trans == null) { trans = visual.VisualTransform; } TransformData data = new TransformData(); data.notFollow = item.notFollow; data.Scale = new Vector3(item.scale, item.scale, item.scale); //不跟随释放者的特效,取挂点的方向 if (item.notFollow && trans != null) { if (trans != null) { data.Rot = trans.rotation.eulerAngles; } else { data.Rot = Vector3.zero; } } if (!string.IsNullOrEmpty(item.soundId)) { string[] array = item.soundId.Split('|'); SoundManager.Instance.Play( int.Parse(array[UnityEngine.Random.Range(0, array.Length)]), item.soundDelay ); } return(mng.AddParticle(item.effect_name, item.loop, trans, data, item.limitry)); }