private void Heal(IHpable hpable) { if (IsPlaced == true) { hpable.Hp.GiveHp(hpAdd, "Healing Station"); } }
private void TryBite(IHpable entity) { if (cooldown.Try()) { entity.Hp.TakeHp(Dmg, "Rusher"); audioSource.PlayOneShot(bite); } }
protected override void OnTriggerEnter2D(Collider2D collision) { base.OnTriggerEnter2D(collision); IHpable entity; if (Check(collision, out entity)) { bitter = entity; } }
public static bool IsFromWrongTeam(this IHpable hpable, Collider2D colider, out Bullet bullet) { if ((bullet = colider.GetComponent <Bullet>()) != null) { return(bullet.Team != hpable.CurrentTeam); } else { return(false); } }
protected override void OnTriggerExit2D(Collider2D collision) { base.OnTriggerExit2D(collision); if (Check(collision, out IHpable entity)) { if (entity == bitter) { bitter = null; } } }
private bool Check(Collider2D col, out IHpable entity) { IHpable moment; if ((moment = col.GetComponent <IHpable>()) != null && moment is Enemy == false) { entity = moment; return(true); } entity = null; return(false); }