コード例 #1
0
        public static void LogChefPositions()
        {
            Vector3 chef1Position = PlayerUtil.GetChefPosition(0);

            Logger.Log($"Chef 1 {Logger.FormatPosition(chef1Position)}");

            Vector3 chef2Position = PlayerUtil.GetChefPosition(1);

            Logger.Log($"Chef 2 {Logger.FormatPosition(chef2Position)}");
        }
コード例 #2
0
        public static void PathFindToPlayer()
        {
            GridNavSpace gridNavSpace = GameUtils.GetGridNavSpace();

            Point2 startPoint  = gridNavSpace.GetNavPoint(PlayerUtil.GetChefPosition(1));
            Point2 targetPoint = gridNavSpace.GetNavPoint(PlayerUtil.GetChefPosition(0));

            path = gridNavSpace.FindPath(startPoint, targetPoint);

            pathIteration = 0;

            currentAction = new MoveAction(ObjectUtil.GetBotControls(), path[0]);

            walkingPath = true;
        }
コード例 #3
0
        public PlateHoldingAction(PlayerControls player)
        {
            this.player = player;

            plate = ComponentUtil.GetClosestComponent <ClientPlate>(PlayerUtil.GetChefPosition(player));
            state = 0;

            if (ComponentUtil.IsPlateOnComponent(plate))
            {
                currentAction = new PathFindAction(player, ComponentUtil.GetPlateLocationComponent(plate));
            }
            else
            {
                currentAction = new PathFindAction(player, plate);
            }
        }
コード例 #4
0
        public new bool Update()
        {
            bool baseResult = base.Update();

            // Check whether the player is currently highlighting its target
            bool highlightedTarget = false;

            if (PlayerUtil.HasHighlighted(player))
            {
                highlightedTarget = PlayerUtil.GetHighlightedObject(player).Equals(target.gameObject);
            }

            if (!baseResult && !highlightedTarget)
            {
                return(false);
            }

            // TODO: face target component before ending
            float facingDif = PlayerUtil.GetAngleFacingDiff(player, target);

            // Logger.Log($"Facing diff: {facingDif}");

            if (facingDif > 40)
            {
                Keyboard.Input input = PlayerUtil.GetInputFacing(player, target);
                // Logger.Log($"Input: {input}");
                Keyboard.Get().SendDown(input);

                return(false);
            }

            Keyboard.Get().StopXMovement();
            Keyboard.Get().StopZMovement();

            Logger.Log("MoveTargetAction done");

            return(true);
        }
コード例 #5
0
 public static void LogCarrying()
 {
     Logger.Log($"Carrying: {PlayerUtil.GetCarrying(ObjectUtil.GetBotControls())}");
 }
コード例 #6
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);
            }
        }