private void FindWork() { foreach (Table t in this.TablesUnderDuty) { if (t.HasOrder()) { this.currentTask = WaiterTask.GetOrder; this.currentTable = t; break; } if (t.IsReadyForCheck()) { this.currentTask = WaiterTask.GetCheck; this.currentTable = t; break; } } foreach (FoodOrder food in this.OwnKitchen.DoneOrders) { if (food.forTable.ResponsibleWaiter == this) { this.currentTask = WaiterTask.GetFood; this.currentTable = food.forTable; break; } } }
private void GetCheckFromTable(Table t) { if (!IsEnrouteToTable(t)) { this.LookingDirection = t.GetStandingAngle(); this.CarriedOrder = t.Order; this.currentTask = WaiterTask.GetReciept; } }
public void DetectDogAt(Vector3 pos) { if (this.currentTask != WaiterTask.ChaseDog && this.currentTask != WaiterTask.PartolForDog) { control.detectors++; this.tabledTask = this.currentTask; } this.currentTask = WaiterTask.ChaseDog; this.LastKnownDogLocation = pos; this.ChaseCoolDown = DogSearchTime; }
private void GetReceipt() { if (!IsEnrouteToRegister()) { this.LookingDirection = OwnRegister.GetStandingAngle(); if (this.CarriedOrder.Status == FoodOrder.OrderStatus.Check) { this.CarriedOrder.DoWork(Time.deltaTime); } else { this.currentTask = WaiterTask.ReturnReciept; } } }
private void PatrolForDog() { const int searchRadius = 20; if (Random.value < 0.01) { this.meshAgent.SetDestination(Human.RandomVector(searchRadius, LastKnownDogLocation)); } LookAt(this.meshAgent.steeringTarget); this.SearchCoolDown -= Time.deltaTime; if (this.SearchCoolDown <= 0) { control.detectors--; this.currentTask = this.tabledTask; } }
private void GetFoodForTable(Table t) { if (!IsEnrouteToKitchen()) { this.LookingDirection = OwnKitchen.GetStandingAngle(); foreach (FoodOrder food in this.OwnKitchen.DoneOrders) { if (food.forTable == t) { this.CarriedOrder = food; break; } } this.OwnKitchen.DoneOrders.Remove(this.CarriedOrder); this.currentTask = WaiterTask.DeliverFood; this.currentTable = t; } }
private void ChaseDog() { LookAt(LastKnownDogLocation); if (Vector3.Distance(this.transform.position, LastKnownDogLocation) > 5) { this.meshAgent.SetDestination(LastKnownDogLocation); } else { this.MoveTo(LastKnownDogLocation); } this.ChaseCoolDown -= Time.deltaTime; if (this.ChaseCoolDown <= 0) { this.currentTask = WaiterTask.PartolForDog; this.SearchCoolDown = DogSearchTime * 2; } }
private void GetTableOrder(Table t) { if (!IsEnrouteToTable(t)) { this.LookingDirection = t.GetStandingAngle(); if (t.Order.Status == FoodOrder.OrderStatus.Idea) { t.Order.DoWork(Time.deltaTime); } else if (t.Order.Status == FoodOrder.OrderStatus.Order) { this.CarriedOrder = t.Order; this.currentTask = WaiterTask.PlaceOrder; } else { //Something went very wrong } } }
private void SetWorkerIdle() { this.currentTask = WaiterTask.Idle; this.currentTable = null; this.CarriedOrder = null; }