Example #1
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;
        }
        public PathFindAction(PlayerControls player, Component component)
        {
            target      = component;
            this.player = player;

            GridNavSpace gridNavSpace = GameUtils.GetGridNavSpace();

            Point2 startPoint  = gridNavSpace.GetNavPoint(player.transform.position);
            Point2 targetPoint = gridNavSpace.GetNavPoint(component.transform.position);

            path             = gridNavSpace.FindPath(startPoint, targetPoint);
            i                = 0;
            hasCurrentAction = false;

            Logger.Log($"PathFindAction instantiated to {target.name}");
        }