Esempio n. 1
0
 /// <summary>
 /// returns the manhattan Distance between tileA and tileB or in other words how many edges you need to cross when moving from tileA to tileB accounting for map wrapping
 /// </summary>
 public int Grid(Vector3Int tileA, Vector3Int tileB)
 {
     if (coordinateWrapper != null)
     {
         tileB = coordinateWrapper.ShiftTargetToClosestPeriodicTilePosition(tileA, tileB);                         //non-wrapping maps just return original
     }
     return(HexGrid.GetDistance.BetweenTiles(tileA, tileB));
 }
        /// <summary>
        /// returns tiles forming a line between origin and target tile, optionally including the origin tile itself
        /// </summary>
        /// ![yellow = origin , blue = target, yellow/blue = line, when includeOrigin = true the origin belongs is part of the line](Map_GetTiles_Lines_Combined.png)
        public List <Vector3Int> Line(Vector3Int origin, Vector3Int target, bool includeOrigin, float horizontalNudgeFromOriginCenter = NudgePositive)
        {
            if (coordinateWrapper != null)
            {
                target = coordinateWrapper.ShiftTargetToClosestPeriodicTilePosition(origin, target);
            }
            List <Vector3Int> lineTiles = HexGrid.GetTiles.Line(origin, target, includeOrigin, horizontalNudgeFromOriginCenter);

            lineTiles = GetValidTileCoordinates(lineTiles);
            return(lineTiles);
        }