Exemplo n.º 1
0
    //interact only true if the player is need to be working
    public override bool Interact(FoodItemTag item, rdEntity user)
    {
        switch (Status)
        {
        case StationStatus.Ready:
            foreach (RecipeInstruction rm in RecipeMenu)
            {
                foreach (FoodItemTag igts in rm.Ingredients)
                {
                    if (igts == item)
                    {
                        user.DropOffItem();
                        CurrentInstruction = rm;
                        rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
                        rdUIManager.UpdateStationPopups(this.gameObject);
                        //TODO multiple cooks
                        CurrentHoldItems.Add(igts);
                        FoodItemTag[] reqs         = CurrentInstruction.Ingredients;
                        bool          startCooking = CurrentHoldItems.OrderBy(x => x).SequenceEqual(reqs.OrderBy(x => x));
                        if (startCooking)
                        {
                            StartTask(user);
                        }
                        return(CurrentInstruction.Type == TaskType.Active);
                    }
                }
            }
            break;

        case StationStatus.Collect:
            if (user.CollectItem(CurrentInstruction.Result))
            {
                Status = StationStatus.Ready;
            }

            RecipeMenu.Remove(CurrentInstruction);
            CurrentHoldItems.Clear();
            //OnHoldInstructionUpdate();
            rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
            rdUIManager.UpdateStationPopups(this.gameObject);
            rdRecipeManager.UpdateInstruction(user.ItemOnHand);
            break;

        default:
            return(false);
        }
        return(false);
    }
Exemplo n.º 2
0
    //TODO, restrict to put anything on unecessary on plates
    public override bool Interact(FoodItemTag item, rdEntity user)
    {
        switch (Status)
        {
        case StationStatus.Inactive:
            if (user.ItemOnHand == FoodItemTag.None)
            {
                return(false);
            }
            CurrentlyHolding.Add(user.ItemOnHand);
            user.DropOffItem();
            bool correctDish = CurrentlyHolding.OrderBy(x => x).SequenceEqual(_requiredMenus.OrderBy(x => x));
            //need to be checked again XD
            if (correctDish)
            {
                Status       = StationStatus.Collect;
                FinalPlating = rdRecipeManager.Seele._currentRecipe.DishName;
                rdUIManager.UpdateStationPopups(this.gameObject, FinalPlating);
                rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
                return(false);
            }
            rdUIManager.UpdateStationPopups(gameObject);
            rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
            break;

        case StationStatus.Collect:
            CurrentlyHolding.Clear();
            user.ItemOnHand = FinalPlating;
            ReadySound.PlayAtPoint(transform.position);
            Status = StationStatus.Inactive;
            rdUIManager.UpdateStationPopups(gameObject);
            rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
            break;

        default:
            break;
        }
        return(false);
    }