override public void OnSight(Observable o) { if (o.GetComponent <Attackable> () && m_attackable.CanAttack(o.GetComponent <Attackable> ().Faction)) { Fighter.CurrentTarget = o.GetComponent <Attackable> (); NextTask(); return; } }
internal void OnTriggerEnter2D(Collider2D other) { Debug.Log("Hit Something: " + other.gameObject); if (other.GetComponent <Attackable> () != null && m_attackable.CanAttack(other.GetComponent <Attackable> ().Faction)) { m_attackable.DamageObj(DamageOnContactEnemy); } }
protected bool canAttack(Attackable atkObj) { return(!(!atkObj || (atkObj.gameObject == Creator) || m_collidedObjs.Contains(atkObj) || !atkObj.CanAttack(Faction))); }