Пример #1
0
 /// <summary>
 /// TODO
 /// </summary>
 public int Grid(Vector3Int cornerA, Vector3Int cornerB)
 {
     if (coordinateWrapper != null)
     {
         cornerB = coordinateWrapper.ShiftTargetToClosestPeriodicCornerPosition(cornerA, cornerB);                            //non-wrapping maps just return original
     }
     return(HexGrid.GetDistance.BetweenCorners(cornerA, cornerB));
 }
        /// <summary>
        /// returns the shortest path of edges from origin to target corner
        /// </summary>
        /// ![green = origin corner , purple = target corner, blue = result](Map_GetEdges_PathBetweenCorners_Combined.png)
        public List <Vector3Int> PathBetweenCorners(Vector3Int originCorner, Vector3Int targetCorner, float horizontalNudgeFromOriginCenter = NudgePositive)
        {
            if (coordinateWrapper != null)
            {
                targetCorner = coordinateWrapper.ShiftTargetToClosestPeriodicCornerPosition(originCorner, targetCorner);
            }
            var edges = HexGrid.GetEdges.PathBetweenCorners(originCorner, targetCorner, horizontalNudgeFromOriginCenter);

            return(GetValidEdgeCoordinates(edges));
            //throw new System.NotImplementedException();
        }
        /// <summary>
        /// returns the shortest path of corners from the origin to the target corner - optionally including the origin
        /// </summary>
        /// ![green = origin , purple = target, blue/purple = result - origin can optionally be included](Map_GetCorners_PathAlongGrid.png)
        public List <Vector3Int> PathAlongGrid(Vector3Int originCorner, Vector3Int targetCorner, bool includeOrigin, float horizontalNudgeFromOriginCenter = NudgePositive)
        {
            if (coordinateWrapper != null)
            {
                targetCorner = coordinateWrapper.ShiftTargetToClosestPeriodicCornerPosition(originCorner, targetCorner);
            }
            List <Vector3Int> cornerCoordinates = HexGrid.GetCorners.PathAlongGrid(originCorner, targetCorner, includeOrigin, horizontalNudgeFromOriginCenter);

            if (coordinateWrapper != null)
            {
                cornerCoordinates = coordinateWrapper.WrapCornerCoordinates(cornerCoordinates);
            }
            return(cornerCoordinates);
        }