public GameObject CreateEffect(string effectName, Vector3 position) { if (string.IsNullOrEmpty(effectName)) { return(null); } GameObject toCreate = GetEffectFromPool(effectName); if (toCreate == null) { toCreate = CreateNewEffectToScene(effectName); toCreate.transform.localPosition = Vector3.zero; toCreate.transform.localRotation = Quaternion.identity; SkillEffect se = toCreate.AddComponent <SkillEffect>(); se.CreateEffect(position); AddCount(se); } else { toCreate.transform.localPosition = Vector3.zero; toCreate.transform.localRotation = Quaternion.identity; SkillEffect se = toCreate.GetComponent <SkillEffect>(); se.EnableEffect(position); AddCount(se); } return(toCreate); }
public GameObject CastEffect(string effectName, Vector3 position, float lifeTime) { if (string.IsNullOrEmpty(effectName)) { return(null); } //if (ShowLog) //{ // Debug.Log("!!CastEffect:" + effectName); //} GameObject toCreate = GetEffectFromPool(effectName); if (toCreate == null) { //if (ShowLog) //{ // Debug.Log(effectName + "不在池中"); //} toCreate = CreateNewEffectToScene(effectName); toCreate.transform.localPosition = Vector3.zero; toCreate.transform.localRotation = Quaternion.identity; SkillEffect se = toCreate.AddComponent <SkillEffect>(); se.CreateEffect(position, lifeTime); AddCount(se); } else { toCreate.transform.localPosition = Vector3.zero; toCreate.transform.localRotation = Quaternion.identity; SkillEffect se = toCreate.GetComponent <SkillEffect>(); se.EnableEffect(position, lifeTime); AddCount(se); } return(toCreate); }