void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player" || other.tag == "Enemy") { ICharacter charScript = other.GetComponent <ICharacter> (); if (_team != charScript.Team) { charScript.ApplyDamage(_damage); Destroy(this.gameObject); } } }
public override void ApplyEffects(ICharacter caster, ICharacter target) { target.ApplyDamage(damage); }
public void Activate() { IDamageType dmgType = IDamageType.Magic; switch (spell.spellRune) { case ISpellRune.Air: dmgType = IDamageType.Air; break; case ISpellRune.Earth: dmgType = IDamageType.Earth; break; case ISpellRune.Fire: dmgType = IDamageType.Fire; break; case ISpellRune.Water: dmgType = IDamageType.Water; break; } switch (spell.spellType) { case ISpellType.Target: if (target) { target.ApplyDamage(spell.value, dmgType); } break; case ISpellType.Radian: ICharacter[] chars = ICharacter.GetNearestFromPointAll(destination, null, spell.range); foreach (ICharacter ch in chars) { ch.ApplyDamage(spell.value, dmgType); } break; case ISpellType.Point: ICharacter c = ICharacter.GetNearestFromPoint(destination, null, 0.5f); if (c) { c.ApplyDamage(spell.value, dmgType); } break; } if (target && caster) { if (!(IReputation.GetEnemity(target.status, caster.status) > 1)) { if (caster.status.reputationType != IReputationType.Bandit && caster.status.reputationType != IReputationType.Monster) { caster.status.reputationType = IReputationType.Bandit; } } } //ISpell.SpellEffect (spell.spellRune, caster.status, trans.position); DestroySpell(); }