public void AddDebuff(string debuff, float slowFactor, PoisonSplash splashPrefab, float tickDamage, float tickTime, float duration) { Debuff temp; switch (debuff) { case "fire": temp = new FireDebuff(tickDamage, tickTime, duration, this); break; case "ice": temp = new IceDebuff(slowFactor, duration, this); break; case "storm": temp = new StormDebuff(this, duration); break; case "poison": temp = new PoisonDebuff(tickDamage, tickTime, splashPrefab, duration, this); break; default: Debug.Log("Debuff error"); temp = new FireDebuff(tickDamage, tickTime, duration, this); break; } if (!debuffs.Exists(x => x.GetType() == debuff.GetType())) { newDebuffs.Add(temp); } }
static public int StaticApply(DamageData attackData) { if (attackData.testAttack) { return(5); } PoisonDebuff pd = attackData.target.GetComponent <PoisonDebuff>(); if (pd == null) { attackData.target.gameObject.AddComponent <PoisonDebuff>(); } return(5); }