public static ChildObject CreateChildObject(int id, Character owner, Transform parentObj, Vector3 targetPos, Character target = null) { excel_child_object data = excel_child_object.Find(id); if (data == null) { Debug.LogError("未找到ID为" + id + "的子物体"); return(null); } ChildObject childObject = new ChildObject(); childObject.Reset(); childObject.mVanish = false; childObject.mContext.Reset(); childObject.mContext.mOwner = owner; childObject.mContext.mChildObject = childObject; childObject.mContext.SkillTargetID = target == null ? 0 : target.gid; childObject.mContext.TargetPos = targetPos; childObject.mData = data; childObject.mParentObj = null; childObject.Init(parentObj); return(childObject); }
public static ChildObject CreateChildObject(int id, Character owner, Transform parentObj, Vector3 targetPos, Character target = null) { excel_child_object data = excel_child_object.Find(id); if (data == null) { Debug.LogError("未找到ID为" + id + "的子物体"); return(null); } GameObject go = ResourceSystem.Load <GameObject>("Particles/Prefabs/" + data.path); if (go == null) { return(null); } go = GameObject.Instantiate(go); ChildObject childObject = go.GetComponent <ChildObject>(); if (childObject == null) { childObject = go.AddComponent <ChildObject>(); } if (!childObject.gameObject.activeSelf) { childObject.gameObject.SetActive(true); } childObject.Reset(); childObject.mVanish = false; childObject.mContext.Reset(); childObject.mContext.mOwner = owner; childObject.mContext.mChildObject = childObject; childObject.mContext.SkillTargetID = target == null ? 0 : target.gid; childObject.mContext.TargetPos = targetPos; childObject.mData = data; childObject.mParentObj = null; childObject.Init(parentObj); return(childObject); }