public AttachMent ChangeAttach(AttachMountType type, PrimitiveVisual visual, string mount, TransformData trans = null) { if (type >= AttachMountType.AttachCount) { return(null); } AttachMent attach = mAttachMents[(uint)type]; if (attach != null && attach.visual == visual) { return(attach); } if (attach != null && attach.visual != null) { attach.visual.Destroy(); } attach = new AttachMent(); attach.visual = visual; attach.socketname = mount; attach.transform = trans; mAttachMents[(uint)type] = attach; return(attach); }
public void ChangeAttach(AttachMountType type, string path, string mount) { MeshVisual visual = new MeshVisual(); visual.CreateWithConfig(path, null, null, false); ChangeAttach(type, visual, mount); }
public AttachMent GetAttach(AttachMountType type) { if (type < 0 || type >= AttachMountType.AttachCount) { return(null); } return(mAttachMents[(int)type]); }
/// <summary> /// 移除挂接物体 /// </summary> /// <param name="type"></param> public void RemoveAttach(AttachMountType type) { if (type >= AttachMountType.AttachCount) { return; } AttachMent attach = mAttachMents[(uint)type]; if (attach != null && attach.visual != null) { attach.visual.Destroy(); } mAttachMents[(uint)type] = null; }
virtual public uint AddEffect(uint resId, string boneName, float dir = float.NaN, AttachMountType atype = AttachMountType.AttachCount) { if (this.Scene == null) { return(uint.MaxValue); } if (!DataManager.EffectTable.ContainsKey(resId)) { return(uint.MaxValue); } EffectTableItem item = DataManager.EffectTable[resId] as EffectTableItem; SceneParticleManager mng = this.Scene.GetParticleManager(); Transform trans = null; if (atype != AttachMountType.Wing) { if (!string.IsNullOrEmpty(boneName) && boneName.StartsWith("%")) { atype = AttachMountType.Weapon; boneName = boneName.Replace("%", ""); } } TransformData data = new TransformData(); data.notFollow = item.notFollow; data.Scale = new Vector3(item.scale, item.scale, item.scale); if (!float.IsNaN(dir)) { data.Rot = new Vector3(0f, dir * Mathf.Rad2Deg, 0f); } if (!string.IsNullOrEmpty(item.soundId)) { string[] array = item.soundId.Split('|'); SoundManager.Instance.Play( int.Parse(array[UnityEngine.Random.Range(0, array.Length)]), item.soundDelay ); } uint instID = mng.AddParticle(item.effect_name, item.loop, trans, data, item.limitry); ParticleAttachMent attach = new ParticleAttachMent(); attach.parent = trans == null ? null : trans.gameObject; attach.particleid = instID; attach.transform = data; attach.socketname = boneName; attach.atype = atype; attach.resid = resId; AttachParticle(attach); return(instID); }