public string GetTypeName() { LCHChannelType t = (LCHChannelType)type; switch (t) { case LCHChannelType.PosX: return(" 位移X"); case LCHChannelType.PosY: return(" 位移Y"); case LCHChannelType.PosZ: return(" 位移Z"); case LCHChannelType.RotY: return(" 旋转Y"); case LCHChannelType.ScaleX: return(" 缩放X"); case LCHChannelType.ScaleY: return(" 缩放Y"); case LCHChannelType.ScaleZ: return(" 缩放Z"); case LCHChannelType.Object: return(" 显示/隐藏"); case LCHChannelType.Event: return(" 事件"); } return(" 不存在"); }
public void SkillLerpFloatChannel(int index, string skillId, int objId, LCHChannelType type, bool messsage = true) { LCHSkillData skill = GetSkill(skillId); if (!HasChannel(skill, objId, (int)type, index) && messsage) { #if UNITY_EDITOR EditorUtility.DisplayDialog("提示", "相同轨迹已经存在", "确定"); #endif return; } LCHChannelData channel = new LCHChannelData(); channel.type = (int)type; channel.objId = objId; if (type == LCHChannelType.ScaleX || type == LCHChannelType.ScaleY || type == LCHChannelType.ScaleZ) { channel.AddKey(0, 0, 1f); } else { channel.AddKey(0, 0, 0f); } skill.subSkills[index].channels.Add(channel); SaveSkill(skill.id); }
bool HasEventChannel(LCHSkillData skill, int objId, LCHChannelType type, int index) { int len = skill.subSkills[index].events.Count; for (int i = 0; i < len; i++) { var c = skill.subSkills[index].events[i]; if (c.type == (int)type && c.objId == objId) { return(false); } } return(true); }
public void SkillEventChannel(string skillId, int objId, LCHChannelType type, int index) { LCHSkillData skill = GetSkill(skillId); if (!HasEventChannel(skill, objId, type, index)) { #if UNITY_EDITOR EditorUtility.DisplayDialog("提示", "相同轨迹已经存在", "确定"); #endif return; } LCHEventChannelData channel = new LCHEventChannelData(); channel.type = (int)type; channel.objId = objId; skill.subSkills[index].events.Add(channel); SaveSkill(skill.id); }
public void CmpObjectEvent(float curTime, float lastTime, LCHEventChannelData _e, ObjectContain contain, LCharacterInterface character, LChatacterInformationInterface information, Dictionary <int, ObjectContain> objs , CdState cdState , string cdName , int skillState , Vector3 baseGroundPos , ref float beginToTarget , ref float endToTarget , ref Vector3 beginTargetPoint ) { if (contain.isFlyTool) { if (null != contain.gameobject) { contain.gameobject.SetActive(false); } return; } LCHChannelType t = (LCHChannelType)_e.type; ObjDictionary value; float _time; float _keyFrameTime; if (t == LCHChannelType.Object) { int res = _e.TryGetKeyFrameRunTime(curTime, lastTime, out value, out _time, out _keyFrameTime); if (res == 1) { if (null != contain.gameobject) { bool enable = value.GetValue <bool>("enable", true); if (_e.objId == -1) { //因為主對象直接設置 gameObject的Enable,所有腳本都不工作了. if (null != contain.roleRenders) { for (int n = 0; n < contain.roleRenders.Length; n++) { contain.roleRenders[n].enabled = enable; } } } else { if (enable) { contain.gameobject.SetActive(false); contain.gameobject.SetActive(true); } else { contain.gameobject.SetActive(enable); } } if (enable) { if (contain.type == 1) { string anim_name = value.GetValue <string>("anim", ""); if (anim_name.Length > 0) { if (null == contain.animaction) { contain.animaction = contain.gameobject.GetComponent <Animation>(); } if (null != contain.animaction) { bool cf = value.GetValue <bool>("crossFade", true); //crossFade contain.animaction[anim_name].time = _time; if (cf) { contain.animaction.CrossFade(anim_name, 0.05f); } else { contain.animaction[anim_name].time = 0f;//特么不这么干不重置。。。 contain.animaction.Play(anim_name); } } } int ex_action = value.GetValueInt("ex_action", 0); if (ex_action == 1) { //主模型. if (_e.objId == -1) { float ToTargetTime = value.GetValueFloat("ex_action", -1f); if (ToTargetTime > 0f) { beginToTarget = _keyFrameTime; endToTarget = _keyFrameTime + ToTargetTime; beginTargetPoint = baseGroundPos; } } } // else if (ex_action == 2) { contain.stopUpatePos = true; } } } } } else if (res == 0) { if (_e.objId != -1)//非主模型,一开始隐藏 { if (null != contain.gameobject) { if (contain.objId != -1) { contain.gameobject.SetActive(false); } } } } } if (t == LCHChannelType.Event) { int res = _e.TryGetKeyFrameRunTime(curTime, lastTime, out value, out _time, out _keyFrameTime); if (res == 1) { if (contain.type == 2 || contain.type == 3) { if (null == contain.collider) { if (null != contain.gameobject) { contain.collider = contain.gameobject.GetComponent <Collider>(); contain.gameobject.layer = character.GetAttackLayer(); if (null != contain.collider) { contain.collider.isTrigger = true; } } } } if (null != contain.gameobject) { bool enable = value.GetValue <bool>("enable", true); contain.gameobject.SetActive(enable); if (contain.collider) { contain.collider.enabled = enable; if (enable) { if (null == contain.hitData) { LCharacterHitDataCmp hdc = contain.gameobject.GetComponent <LCharacterHitDataCmp>(); if (null == hdc) { hdc = contain.gameobject.AddComponent <LCharacterHitDataCmp>(); } contain.hitData = hdc.data; } contain.hitData.type = "hit"; LCharacterHitData hitData = new LCharacterHitData(); hitData.hittedObject.Clear(); hitData.value = value; hitData.characterId = character.GetId(); hitData.firstHit = true; hitData.cdName = cdName; hitData.skillState = skillState; hitData.cdState = cdState; int effectId = value.GetValueInt("hit_effect", -2); if (effectId != -2 && objs.ContainsKey(effectId)) { var ct = objs[effectId]; hitData.effect = ct.mod; hitData.effect_obj = ct.baseGameObject; } else { hitData.effect = null; hitData.effect_obj = null; } contain.hitData.data = hitData; int IsFlyTool = value.GetValueInt("IsFlyTool", 0); if (IsFlyTool == 1) { if (contain.type == 3) { float FlyToolTime = value.GetValueFloat("FlyToolTime", 20f); float FlyToolSpeed = value.GetValueFloat("FlyToolSpeed", 2f); if (null != contain.gameobject) { var g = GameObject.Instantiate(contain.gameobject); LCharacterHitDataCmp hdc0 = g.GetComponent <LCharacterHitDataCmp>(); g.name = "bullet"; LCHBullet bullet = g.AddComponent <LCHBullet>(); hdc0.data.data = hitData; hdc0.data.type = "hit"; contain.isFlyTool = true; bullet.type = LCHBullet.TYPE.NORMAL; bullet.speed = FlyToolSpeed; bullet.maxTime = FlyToolTime; g.SetActive(true); contain.gameobject.SetActive(false); } } } else if (IsFlyTool == 2) { if (contain.type == 3) { //float FlyToolTime = value.GetValueFloat("FlyToolTime", 20f); float FlyToolSpeed = value.GetValueFloat("FlyToolSpeed", 2f); if (null != contain.gameobject) { var g = GameObject.Instantiate(contain.gameobject); LCharacterHitDataCmp hdc0 = g.GetComponent <LCharacterHitDataCmp>(); g.name = "bullet"; LCHBullet bullet = g.AddComponent <LCHBullet>(); hdc0.data.data = hitData; hdc0.data.type = "hit"; contain.isFlyTool = true; bullet.type = LCHBullet.TYPE.FELLOW; bullet.speed = FlyToolSpeed; bullet.curTargetId = curTargetId; bullet.maxTime = 60f; g.SetActive(true); contain.gameobject.SetActive(false); } } } } } } } else if (res == 0) { if (null != contain.gameobject) { contain.gameobject.SetActive(false); } } } }
public static void CmpAnimationPos(float curTime, ObjectContain contain, LCharacterInterface character, LChatacterInformationInterface information) { if (contain.isFlyTool) { return; } contain.ResetTransformData(); for (int i = 0, c0 = contain.channels.Count; i < c0; i++) { var channel = contain.channels[i]; LCHChannelType t = (LCHChannelType)channel.type; switch (t) { case LCHChannelType.PosX: { float v = channel.GetLerpValue(curTime); contain.pos += new Vector3(v, 0f, 0f); break; } case LCHChannelType.PosY: { float v = channel.GetLerpValue(curTime); contain.pos += new Vector3(0f, v, 0f); break; } case LCHChannelType.PosZ: { LCHChannelData.debug = true; float v = channel.GetLerpValue(curTime); LCHChannelData.debug = false; contain.pos += new Vector3(0f, 0f, v); break; } case LCHChannelType.RotY: { contain.rot = channel.GetSlerpYValue(curTime); break; } case LCHChannelType.ScaleX: { float v = channel.GetLerpValue(curTime); contain.scale = new Vector3(v, contain.scale.y, contain.scale.z); break; } case LCHChannelType.ScaleY: { float v = channel.GetLerpValue(curTime); contain.scale = new Vector3(contain.scale.x, v, contain.scale.z); break; } case LCHChannelType.ScaleZ: { float v = channel.GetLerpValue(curTime); contain.scale = new Vector3(contain.scale.x, contain.scale.y, v); break; } } } }
public void ComputeAnim(float curTime, int index) { #if UNITY_EDITOR SetObjectParent(index); #endif //初始化. role.ResetTransformData(); for (int i = 0, c0 = subDatas[index].objs.Count; i < c0; i++) { var o0 = subDatas[index].objs[i]; o0.ResetTransformData(); } //计算位置变换. for (int i = 0, c0 = _skillData.subSkills[index].channels.Count; i < c0; i++) { var channel = _skillData.subSkills[index].channels[i]; var contain = GetObjectContainById(channel.objId, index); LCHChannelType t = (LCHChannelType)channel.type; #if UNITY_EDITOR if (channel.times.Count == 0 || channel.times[0] != 0) { channel.AddKey(0, 0); if (t == LCHChannelType.PosX || t == LCHChannelType.PosY || t == LCHChannelType.PosZ) { channel.values[0] = 0f; } else if (t == LCHChannelType.ScaleX || t == LCHChannelType.ScaleY || t == LCHChannelType.ScaleZ) { channel.values[0] = 1f; } else if (t == LCHChannelType.RotY) { channel.values[0] = 0f; } } #endif switch (t) { case LCHChannelType.PosX: { float v = channel.GetLerpValue(curTime); contain.pos += new Vector3(v, 0f, 0f); break; } case LCHChannelType.PosY: { float v = channel.GetLerpValue(curTime); contain.pos += new Vector3(0f, v, 0f); break; } case LCHChannelType.PosZ: { float v = channel.GetLerpValue(curTime); contain.pos += new Vector3(0f, 0f, v); break; } case LCHChannelType.RotY: { contain.rot = channel.GetSlerpYValue(curTime); break; } case LCHChannelType.ScaleX: { float v = channel.GetLerpValue(curTime); contain.scale = new Vector3(v, contain.scale.y, contain.scale.z); break; } case LCHChannelType.ScaleY: { float v = channel.GetLerpValue(curTime); contain.scale = new Vector3(contain.scale.x, v, contain.scale.z); break; } case LCHChannelType.ScaleZ: { float v = channel.GetLerpValue(curTime); contain.scale = new Vector3(contain.scale.x, contain.scale.y, v); break; } } } //赋值。 { if (null != role.gameobject) { role.gameobject.transform.localPosition = role.pos; role.gameobject.transform.localRotation = role.rot; role.gameobject.transform.localScale = role.scale; } } for (int i = 0, c0 = subDatas[index].objs.Count; i < c0; i++) { var o0 = subDatas[index].objs[i]; if (null == o0.gameobject) { continue; } o0.gameobject.transform.localPosition = o0.pos; o0.gameobject.transform.localRotation = o0.rot; o0.gameobject.transform.localScale = o0.scale; } //计算物体事件,比如播放动作,声音等。 for (int i = 0, c0 = _skillData.subSkills[index].events.Count; i < c0; i++) { var _e = _skillData.subSkills[index].events[i]; var contain = GetObjectContainById(_e.objId, index); LCHChannelType t = (LCHChannelType)_e.type; ObjDictionary value; float _time; if (t == LCHChannelType.Object) { if (_e.TryGetKeyFrame(curTime, out value, out _time)) { if (null != contain.gameobject) { bool enable = value.GetValue <bool>("enable", true); contain.gameobject.SetActive(enable); if (enable) { string anim_name = value.GetValue <string>("anim", ""); if (anim_name.Length > 0) { if (null == contain.animaction) { contain.animaction = contain.gameobject.GetComponent <Animation>(); } if (null != contain.animaction) { contain.animaction[anim_name].time = _time; //animation[anim_name].speed = 0.0; contain.animaction.Play(anim_name); contain.animaction.Sample(); contain.animaction.Stop(); } } if (_e.objId != -1) { ParticleSystemHelper.Simulate(contain.gameobject, _time); } } } } else { if (null != contain.gameobject) { if (contain.objId != -1) { contain.gameobject.SetActive(false); } } } } if (t == LCHChannelType.Event) { if (_e.TryGetKeyFrame(curTime, out value, out _time)) { if (null != contain.gameobject) { bool enable = value.GetValue <bool>("enable", true); contain.gameobject.SetActive(enable); } } else { if (null != contain.gameobject) { contain.gameobject.SetActive(false); } } } } }
public void OnGUI1() { var layourWidth30 = GUILayout.Width(30f); var layourWidth80 = GUILayout.Width(80f); var layourWidth20 = GUILayout.Width(20f); var layourWidth100 = GUILayout.Width(100f); var layourWidth200 = GUILayout.Width(200f); Color selectColor = new Color(0.4f, 0.4f, 1.0f); if (null == roleData) { return; } if (SkillEditorData.Instance.CurSkillId.Length == 0) { return; } LCHSkillData skill = null; if (SkillEditorData.Instance.CurSkillId.Length > 0) { skill = SkillEditorData.Instance.skillsData.GetSkill(SkillEditorData.Instance.CurSkillId); } if (null == skill) { return; } var buttonRect = EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("添加对象", layourWidth80)) { SkillEditorData.Instance.skillsData.SkillAddObject(SkillEditorData.Instance.CurSkillId); } if (GUILayout.Button("添加碰撞体", layourWidth80)) { SkillEditorData.Instance.skillsData.SkillAddBoxCollider(SkillEditorData.Instance.CurSkillId); } EditorGUI.BeginDisabledGroup(null == anim); if (GUILayout.Button("原碰撞体", layourWidth80)) { PopupWindow.Show(buttonRect, ColliderDialog.Show(anim.transform, OnColliderAdd, SkillEditorData.Instance.CurSkillId)); } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("音效", layourWidth80)) { SkillEditorData.Instance.skillsData.SkillAddSound(SkillEditorData.Instance.CurSkillId); } EditorGUILayout.EndHorizontal(); GUILayout.Label("对象列表:"); scrollViewPos3 = GUILayout.BeginScrollView(scrollViewPos3, GUILayout.Height(120)); { var rect = EditorGUILayout.BeginHorizontal(); bool b0 = selectObjId == -1; if (b0) { EditorGUI.DrawRect(rect, selectColor); } if (EditorGUILayout.Toggle("", b0, layourWidth20)) { selectObjId = -1; } EditorGUI.BeginDisabledGroup(true); GUILayout.TextField("角色", layourWidth80); EditorGUILayout.ObjectField(anim, typeof(Animation), false); GUILayout.Button("-", layourWidth30); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); } if (skill != null) { for (int i = 0; i < skill.objs.Length; i++) { LCHObjectData obj = skill.objs[i]; var rect = EditorGUILayout.BeginHorizontal(); bool b0 = selectObjId == obj.id; if (b0) { EditorGUI.DrawRect(rect, selectColor); } if (EditorGUILayout.Toggle("", b0, layourWidth20)) { selectObjId = obj.id; } obj.name = GUILayout.TextField(obj.name, layourWidth80); if (obj.type == 1) { UpdateGameObject(obj); } else if (obj.type == 2 || obj.type == 3) { EditorGUI.BeginDisabledGroup(true); GUILayout.TextField("触发器"); EditorGUI.EndDisabledGroup(); } else if (obj.type == 4) { UpdateSound(obj); } if (GUILayout.Button("-", layourWidth30)) { if (selectObjId == obj.id) { selectObjId = -1; } SkillEditorData.Instance.skillsData.RemoveObject(skill.id, obj.id); } EditorGUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); SpeceLine(); GUILayout.Label("属性列表:"); scrollViewPos4 = GUILayout.BeginScrollView(scrollViewPos4, GUILayout.Height(200)); LCHObjectData selectObject = null; if (selectObjId > -1) { selectObject = skill.GetObject(selectObjId); if (selectObject.type == 3) { var rect = EditorGUILayout.BeginHorizontal(); //EditorGUI.BeginDisabledGroup(selectObject.type == 3); //selectObject.type GUILayout.Label("绑定对象", GUILayout.Width(80f)); int bind0 = selectObject.propertys.GetValueInt("bind", 0); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.TextField(selectObject.propertys.GetValue <string>("bind_name", "")); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); } if (selectObject.type != 4) { var rect = EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(selectObject.type == 3); //selectObject.type GUILayout.Label("绑定方式", GUILayout.Width(80f)); int bind0 = selectObject.propertys.GetValueInt("bind", 0); int bind = EditorGUILayout.Popup(bind0, bindingStr, GUILayout.Width(100f)); selectObject.propertys["bind"] = bind; if (bind == 2) { selectObject.propertys["bind_name"] = EditorGUILayout.TextField(selectObject.propertys.GetValue <string>("bind_name", "")); if (GUILayout.Button("..")) { PopupWindow.Show(rect, ChildsNameDialog.Show(OnBindNameCallBack, selectObject.propertys)); } } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); SpeceLine(); GUILayout.Label("事件属性:"); GUILayout.BeginHorizontal(); //1 Dictionary <string, object> property_params = new Dictionary <string, object>(); scrollViewPos5 = GUILayout.BeginScrollView(scrollViewPos5, GUILayout.Height(200)); if (skill != null) { if (null != SkillEditorWindow.selectEvent && null != SkillEditorWindow.selectEventChannel) { int objId = SkillEditorWindow.selectEventChannel.objId; var _object = skill.GetObject(objId); LCHChannelType _type = (LCHChannelType)SkillEditorWindow.selectEventChannel.type; if (_type == LCHChannelType.Event) { GUILayout.BeginHorizontal();//2 PropertyHelper.DrawPropertyTips("激活状态"); bool eEnable = EditorGUILayout.Toggle(SkillEditorWindow.selectEvent.GetValue <bool>("enable", true)); SkillEditorWindow.selectEvent["enable"] = eEnable; GUILayout.EndHorizontal();//2 string[] sounds = ArrayHelper.emptyStringList; int[] soundIds = ArrayHelper.emptyIntList; string [] objectNames = ArrayHelper.emptyStringList; int[] objectid = ArrayHelper.emptyIntList; if (null != SkillEditorData.Instance.skill) { SkillEditorData.Instance.skill.GetAllObjectList(objId, ref sounds, ref soundIds, ref objectNames, ref objectid); } if (eEnable) { property_params["sounds"] = sounds; property_params["soundIds"] = soundIds; property_params["objectNames"] = objectNames; property_params["objectid"] = objectid; PropertyHelper.DrawPropertys(SkillEditorWindow.selectEvent, SkillEditorData.Instance.skillsData.GetEventTemp(), SkillEditorData.Instance.skillsData.GetEventNames(), property_params); } } else if (_type == LCHChannelType.Object) { string [] anims = ArrayHelper.emptyStringList; if (null != SkillEditorData.Instance.skill) { anims = SkillEditorData.Instance.skill.GetAnimList(objId); } property_params["anims"] = anims; PropertyHelper.DrawPropertys(SkillEditorWindow.selectEvent, SkillEditorData.Instance.skillsData.GetObjecctTemp(), SkillEditorData.Instance.skillsData.GetObjectNames(), property_params); } else if (_type == LCHChannelType.RoleState) { string[] anims = ArrayHelper.emptyStringList; if (null != SkillEditorData.Instance.skill) { anims = SkillEditorData.Instance.skill.GetAnimList(objId); } PropertyHelper.DrawPropertys(SkillEditorWindow.selectEvent, SkillEditorData.Instance.skillsData.GetRoleStateTemp(), SkillEditorData.Instance.skillsData.GetRoleStateNames(), null); } } } GUILayout.EndScrollView(); GUILayout.EndHorizontal();//1 }
public static void CmpObjectEvent(float curTime, float lastTime, LCHEventChannelData _e, ObjectContain contain, LChatacterInterface character, LChatacterInformationInterface information, Dictionary <int, ObjectContain> objs , CdState cdState , string cdName , int skillState ) { LCHChannelType t = (LCHChannelType)_e.type; ObjDictionary value; float _time; if (t == LCHChannelType.Object) { int res = _e.TryGetKeyFrameRunTime(curTime, lastTime, out value, out _time); if (res == 1) { if (null != contain.gameobject) { bool enable = value.GetValue <bool>("enable", true); if (_e.objId == -1) { //因為主對象直接設置 gameObject的Enable,所有腳本都不工作了. if (null != contain.roleRenders) { for (int n = 0; n < contain.roleRenders.Length; n++) { contain.roleRenders[n].enabled = enable; } } } else { if (enable) { contain.gameobject.SetActive(false); contain.gameobject.SetActive(true); /*contain.gameobject.SetActive(enable); * for (int i = 0, l = contain.systems.Length; i < l; i++) * { * //Debug.Log(contain.systems[i].isStopped); * contain.systems[i].gameObject.SetActive(false); * contain.systems[i].gameObject.SetActive(true); * contain.systems[i].Play(true); * }*/ } else { contain.gameobject.SetActive(enable); } //Debug.LogError("_e.objId " + _e.objId + " " + enable); //contain.gameobject.SetActive(enable); } if (enable) { if (contain.type == 1) { string anim_name = value.GetValue <string>("anim", ""); if (anim_name.Length > 0) { if (null == contain.animaction) { contain.animaction = contain.gameobject.GetComponent <Animation>(); } if (null != contain.animaction) { bool cf = value.GetValue <bool>("crossFade", true); //crossFade contain.animaction[anim_name].time = _time; if (cf) { contain.animaction.CrossFade(anim_name, 0.05f); } else { contain.animaction[anim_name].time = 0f;//特么受击不这么干不重置。。。 contain.animaction.Play(anim_name); } } } } } } } else if (res == 0) { if (_e.objId != -1)//非主模型,一开始隐藏 { if (null != contain.gameobject) { if (contain.objId != -1) { contain.gameobject.SetActive(false); } } } } } if (t == LCHChannelType.Event) { int res = _e.TryGetKeyFrameRunTime(curTime, lastTime, out value, out _time); if (res == 1) { if (contain.type == 2 || contain.type == 3) { if (null == contain.collider) { if (null != contain.gameobject) { contain.collider = contain.gameobject.GetComponent <Collider>(); contain.gameobject.layer = character.GetAttackLayer(); if (null != contain.collider) { contain.collider.isTrigger = true; } } } } if (null != contain.gameobject) { bool enable = value.GetValue <bool>("enable", true); contain.gameobject.SetActive(enable); if (contain.collider) { contain.collider.enabled = enable; if (enable) { if (null == contain.hitData) { LCharacterHitDataCmp hdc = contain.gameobject.GetComponent <LCharacterHitDataCmp>(); if (null == hdc) { hdc = contain.gameobject.AddComponent <LCharacterHitDataCmp>(); } contain.hitData = hdc.data; } contain.hitData.type = "hit"; LCharacterHitData hitData = new LCharacterHitData(); hitData.hittedObject.Clear(); hitData.value = value; hitData.characterId = character.GetId(); hitData.firstHit = true; hitData.cdName = cdName; hitData.skillState = skillState; hitData.cdState = cdState; int effectId = value.GetValueInt("hit_effect", -2); if (effectId != -2 && objs.ContainsKey(effectId)) { var ct = objs[effectId]; hitData.effect = ct.mod; hitData.effect_obj = ct.baseGameObject; } else { hitData.effect = null; hitData.effect_obj = null; } contain.hitData.data = hitData; } } } } else if (res == 0) { if (null != contain.gameobject) { contain.gameobject.SetActive(false); } } } }