public void FindTarget() { //target = npcManager.GetClosestTarget(transform.position); if (target != null && target.GetComponent <Fleetship>() != null) { target = target.GetComponent <Fleetship>().GetClosestShipPart(transform.position).gameObject; } else { target = npcManager.GetClosestTarget(transform.position); } }