void UpdateForTarget() { // Pick the compass target. If not targeting customer, find the closest one. // If targeting customer, point at it. If carrying a customer, point to the destination. GameObject currentTarget = null; if (!carryingCustomer && targetCustomer == null) { currentTarget = ClosestCustomer(); } else if (!carryingCustomer && targetCustomer != null) { currentTarget = targetCustomer; } else if (carryingCustomer) { currentTarget = customerDestination; } if (currentTarget) { if (compass) { compass.SetTarget(currentTarget); } if (aiController) { aiController.SetTarget(currentTarget.transform); } } }