예제 #1
0
 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);
 }
예제 #2
0
    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));
    }
예제 #3
0
 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);
     }
 }
예제 #4
0
    // 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);
    }
예제 #5
0
 private void DestroyFoodAndUpdateScore(PlateEntity plate)
 {
     OrderManager.Instance.RemoveOrder(ItemContainer.Instance.GetCompletedRecipe(plate));
     plate.RaiseEvent('s', true);
     // TODO: Implement score update
 }