Exemplo n.º 1
0
        public ChopIngredientAction(PlayerControls player)
        {
            this.player = player;
            state       = 0;

            workstation = ComponentUtil.GetClosestMatchingComponent <ClientWorkstation>(
                player.transform.position, IsChoppingNotBlocked
                );

            currentAction =
                new PathFindAction(
                    player,
                    workstation
                    );

            Logger.Log("ChopIngredientAction instantiated");
        }
Exemplo n.º 2
0
        public CookIngredientAction(PlayerControls player)
        {
            Logger.Log("CookIngredientAction instantiated");

            this.player = player;
            state       = 0;

            cookableContainer =
                ComponentUtil.GetClosestMatchingComponent <ClientCookableContainer>(player.transform.position,
                                                                                    IsCookablePot);
            Logger.Log($"Cookable container pos: {Logger.FormatPosition(cookableContainer.transform.position)}");
            bool cookableOnStation = false;

            foreach (var possibleCookingStation in Object.FindObjectsOfType <ClientCookingStation>())
            {
                Logger.Log($"Station pos: {Logger.FormatPosition(possibleCookingStation.transform.position)}");
                if (IsCookableOnStation(cookableContainer, possibleCookingStation))
                {
                    cookableOnStation = true;
                    cookingStation    = possibleCookingStation;
                    break;
                }
            }

            if (cookableOnStation)
            {
                currentAction =
                    new PathFindAction(
                        player,
                        cookingStation
                        );

                state = 3;
            }
            else
            {
                currentAction =
                    new PathFindAction(
                        player,
                        cookableContainer
                        );
            }
        }
Exemplo n.º 3
0
        public bool Update()
        {
            switch (state)
            {
            case 0:
                if (currentAction.Update())
                {
                    currentAction.End();
                    state         = 1;
                    currentAction = new PickDropAction(player, true);
                }

                return(false);

            case 1:
                if (currentAction.Update())
                {
                    currentAction.End();

                    if (!PlayerUtil.IsCarrying(player))
                    {
                        return(true);
                    }
                    // Still holding something, for instance a pan or pot
                    Logger.Log("Still holding something after plating");
                    state = 2;

                    ClientAttachStation clientAttachStation =
                        ComponentUtil.GetClosestMatchingComponent <ClientAttachStation>(
                            player.transform.position, IsAttachStationEmptyAndClean);

                    currentAction =
                        new PathFindAction(
                            player,
                            clientAttachStation
                            );
                }

                return(false);

            case 2:
                if (currentAction.Update())
                {
                    currentAction.End();

                    state = 3;

                    currentAction = new PickDropAction(player);
                }

                return(false);

            case 3:
                if (currentAction.Update())
                {
                    currentAction.End();

                    return(true);
                }

                return(false);

            default:
                return(false);
            }
        }