public int GetCompletedRecipe(PlateEntity plate) { foreach (var r in recipes) { var rhash = new HashSet <int>(r.ingredients); if (rhash.SetEquals(plate.ingredients)) { return(r.index); } } return(-1); }
private bool FoodIsCurrentOrder(PlateEntity plate) { // TODO: Implement Food Check var isrecipe = ItemContainer.Instance.GetCompletedRecipe(plate); if (isrecipe == -1) { return(false); } return(OrderManager.Instance.IsAnOrder(isrecipe)); }
public void Activate(PlayerEntity player) { if (foodID == -1) { var item = PlateEntity.CreateEntity() as PlateEntity; UnitEntityManager.Local.Register(item); item.Activate(player); } else { var item = FoodEntity.CreateEntity() as FoodEntity; item.foodID = foodID; UnitEntityManager.Local.Register(item); item.Activate(player); } }
// Should use an enum // -1 == deny // 0 == done // 1 == progress public bool GetRecipeResult(PlateEntity plate, FoodEntity food) { // immediatly deny if the plate already as the ingredient if (plate.ingredients.Contains(food.foodID)) { return(false); } foreach (var r in recipes) { // if the recipe has the ingredient if (r.ingredients.Contains(food.foodID)) { return(true); } } return(false); }
private void DestroyFoodAndUpdateScore(PlateEntity plate) { OrderManager.Instance.RemoveOrder(ItemContainer.Instance.GetCompletedRecipe(plate)); plate.RaiseEvent('s', true); // TODO: Implement score update }