public void AddDebuff(string debuffName, int duration, HeroManager source, HeroManager target) { //Debug.Log("Debuff Name: " +debuffName); if (!target.gameObject.GetComponent(System.Type.GetType(debuffName))) { (target.gameObject.AddComponent(System.Type.GetType(debuffName)) as Debuff).New(duration, source.gameObject); } else { Debug.Log("Debuff Already exists!"); Debuff debuff = target.gameObject.GetComponent(System.Type.GetType(debuffName)) as Debuff; if (debuff.duration < duration) { debuff.duration = duration; debuff.gameObject.GetComponentInChildren <BuffPanel>().UpdateBuffIconCD(debuffName, duration); } } target.E_PopupMSG(debuffName); }
public void AddBuff(string buffName, int duration, HeroManager source, HeroManager target) { if (!target.gameObject.GetComponent(System.Type.GetType(buffName))) { (target.gameObject.AddComponent(System.Type.GetType(buffName)) as Buff).New(duration, source.gameObject); } else { Debug.Log("Buff Already exists!"); Buff buff = target.gameObject.GetComponent(System.Type.GetType(buffName)) as Buff; if (buff.duration < duration) { buff.duration = duration; buff.gameObject.GetComponentInChildren <BuffPanel>().UpdateBuffIconCD(buffName, duration); } } target.E_PopupMSG(buffName); //Debug.Log("Add Buff" +buffName); } //AddBuff