}//ServeClient public void CookAndServe() { List <BasicAI> toRemove = new List <BasicAI>(); for (int i = 0; i < orderedQueue.Count; i++) { BasicAI client = orderedQueue[i]; if (!cooking.ContainsKey(client)) { GameUtils.Utils.WarningMessage(client.name + " has no cooking food?!"); continue; }//if Recepe foodOnTheGrill = cooking[client]; bool isCooked = foodOnTheGrill.Cook(Time.deltaTime); if (isCooked) { toRemove.Add(client); ServeClient(client, foodOnTheGrill); } //if cooked } //for foreach (BasicAI served in toRemove) { if (!cooking.ContainsKey(served)) { continue; } //Destroy(cooking[served].gameObject); cooking.Remove(served); } //foreach } //Cook
}//Order public float RecieveOrder(Recepe toRecieve) { this.eState = StateMachine.walking; _thoughtsProcessor.ShowFeedback(FeedbackThoughts.Feedbacks.Happy, true); //TODO: calculate satisfaction value and tip percent return(1); }//RecieveOrder
}//TakeOrder public void ServeClient(BasicAI client, Recepe toServe) { float cash = client.RecieveOrder(toServe); _shopStorage.Cash += cash; if (orderedQueue.Contains(client)) { orderedQueue.Remove(client); } }//ServeClient
internal Recepe Find(Slot[] Grid) { string key = Recepe.GetKeyFromGrid(Grid); if (recepies.ContainsKey(key)) { return(recepies[key]); } return(null); }
public void TestRecipe() { Product.Content.Clear(); Recepe recepe = CraftingTableRecipes.Instance.Find(Grid); if (recepe == null) { return; } Product.Content.ReplaceWith(recepe.Product); }
}//MoveTowardsDirection public void SetState(StateMachine newState) { eState = newState; if (eState == StateMachine.standingInLine) { foodToOrder = (FoodPref.Length == 0) ?_shop.PickAnyFromMenu() : foodToOrder = pickFoodFromPrefs(); if (foodToOrder == null) { eState = StateMachine.walking; return; } waitTime = Random.Range(MaxWaitingTime.x, MaxWaitingTime.y); } }//SetState
}//RemoveFromWaitQueue /// <summary> /// Take order from the clinet (in the queue). Cook the /// food for Food.cooktime seconds and serve it when ready. /// </summary> public void TakeOrder() { if (orderedQueue.Count >= 2) { return; } if (waitingQueue.Count == 0) { return; } var client = waitingQueue[0]; RemoveFromWaitQueue(client); orderedQueue.Add(client); //dispose food for the client if he ordered before, //but food was not removed from the grill. DisposeCooked(client); Recepe foodToCook = new Recepe(); cooking.Add(client, foodToCook); }//TakeOrder
}//DisposeCooked /// <summary> /// Check if desiered food is in the shop's menu. /// Return True if recepe exists. False = no such food. /// </summary> /// <param name="toFind">Food to find in the menu</param> /// <returns></returns> public bool CheckFoodInMenu(Recepe toFind) { //FIXME return(true); }//CheckFoodInMenu
protected void AddRecipe(Recepe recepe) { recepies.Add(recepe.Key, recepe); }