public static void Flee(Unit unit) { GameObject closestEnemy = UnitQueries.ClosestEnemyInRange(unit); if (closestEnemy == null || closestEnemy.GetComponent<Unit>() == null) return; SetFleeingTarget(unit, closestEnemy.GetComponent<Unit>()); }
public static void TargetEnemy(Unit unit) { GameObject closestEnemy = UnitQueries.ClosestEnemyInRange(unit); if (closestEnemy == null || closestEnemy.GetComponent<Unit>() == null) return; unit.GetComponent<Target>().Change(closestEnemy, closestEnemy.GetComponent<Unit>().interactionRadius); }