private List <GridTile> GetValidTilesInChargeDirection(Directions direction, GridTile top, MovementStyle style, List <GridTile> accumulator)
    {
        var neighbor = GridController.instance.GetNeighborAt(direction, top.WorldLocation);

        if (neighbor != null && style.elligibleStartingStates.Contains(neighbor.State))
        {
            var leftoverMovement = top.CurrentMovementValue - style.individualMoveCost;
            if (leftoverMovement >= 0 && leftoverMovement > neighbor.CurrentMovementValue)
            {
                if (leftoverMovement == 0 && neighbor.State != GridTile.MovementState.OCCUPIED)
                {
                    //At the max charge distance and unoccupied, don't include this tile
                    return(accumulator);
                }

                if (neighbor.State == GridTile.MovementState.OCCUPIED)
                {
                    neighbor.CurrentMovementValue = 0;
                }
                else
                {
                    neighbor.CurrentMovementValue = top.CurrentMovementValue - neighbor.Cost;
                }

                neighbor.UpdateState(style.targetState);
                accumulator.Add(neighbor);
                return(GetValidTilesInChargeDirection(direction, neighbor, style, accumulator));
            }
        }

        return(accumulator);
    }
    private GridTile CheckIfTileInRegion(GridTile top, Directions direction, Queue <GridTile> q, MovementStyle style)
    {
        var neighbor = GridController.instance.GetNeighborAt(direction, top.WorldLocation);

        if (neighbor != null)
        {
            var moveNormallyEligible = top.CurrentMovementValue - style.individualMoveCost >= 0 && top.CurrentMovementValue - style.individualMoveCost > neighbor.CurrentMovementValue;
            var moveInExcludedRegion = moveNormallyEligible && (top.CurrentMovementValue - style.individualMoveCost > style.actionCost - style.regionFilter);
            if (moveNormallyEligible)
            {
                neighbor.CurrentMovementValue = top.CurrentMovementValue - neighbor.Cost;
                q.Enqueue(neighbor);

                if (!moveInExcludedRegion && style.elligibleStartingStates.Contains(neighbor.State))
                {
                    neighbor.UpdateState(style.targetState);
                    return(neighbor);
                }
                else
                {
                    neighbor.UpdateState(style.targetState);
                    tilesToReset.Add(neighbor);
                }
            }
        }
        return(null);
    }
    private GridTile CheckThenSetStateOfNeighborAtTile(GridTile top, Directions direction, Queue <GridTile> q, MovementStyle style)
    {
        var neighbor = GridController.instance.GetNeighborAt(direction, top.WorldLocation);

        if (neighbor != null && style.elligibleStartingStates.Contains(neighbor.State))
        {
            if (top.CurrentMovementValue - style.individualMoveCost >= 0 && top.CurrentMovementValue - style.individualMoveCost > neighbor.CurrentMovementValue)
            {
                neighbor.UpdateState(style.targetState);
                neighbor.CurrentMovementValue = top.CurrentMovementValue - neighbor.Cost;
                q.Enqueue(neighbor);

                return(neighbor);
            }
        }
        return(null);
    }
    private List <GridTile> GetValidTilesInCardinalDirection(Directions direction, GridTile top, MovementStyle style, List <GridTile> accumulator)
    {
        var neighbor = GridController.instance.GetNeighborAt(direction, top.WorldLocation);

        if (neighbor != null && style.elligibleStartingStates.Contains(neighbor.State))
        {
            if (top.CurrentMovementValue - style.individualMoveCost >= 0 && top.CurrentMovementValue - style.individualMoveCost > neighbor.CurrentMovementValue)
            {
                neighbor.UpdateState(style.targetState);
                neighbor.CurrentMovementValue = top.CurrentMovementValue - neighbor.Cost;

                accumulator.Add(neighbor);
                return(GetValidTilesInCardinalDirection(direction, neighbor, style, accumulator));
            }
        }

        return(accumulator);
    }