Ejemplo n.º 1
0
        private void SetMovementPathToNewExploreLocation(WorldView worldView)
        {
            // find closest unexplored cell
            var cellGrid = worldView.CellGrid;
            var cell     = cellGrid.GetClosestUnexploredCell(StackView.LocationHex);

            if (cell == Cell.Empty)
            {
                // all locations explored
                StackView.SetStatusToNone();
                StackView.Unselect();
            }

            // find best path to unexplored cell
            var path = MovementPathDeterminer.DetermineMovementPath(StackView.HexLibrary, StackView.Stack, StackView.LocationHex, cell.ToPoint, cellGrid);

            if (path.Count == 0)
            {
                // could not find a path to location
                StackView.SetStatusToNone();
                StackView.Unselect();
            }

            path = path.RemoveLast(StackView.SightRange);
            StackView.MovementPath = path;
        }
        private List <PointI> GetPotentialMovementPath(Stack stack, CellGrid cellGrid, Point mouseLocation, Camera camera)
        {
            var(potentialMovement, hexToMoveTo) = CheckForPotentialUnitMovement(stack, cellGrid, mouseLocation, camera);
            if (!potentialMovement)
            {
                return(new List <PointI>());
            }

            var path = MovementPathDeterminer.DetermineMovementPath(StackView.HexLibrary, stack, stack.LocationHex, hexToMoveTo, cellGrid);

            return(path);
        }