/// <summary> /// A new destination is needed if you cannot reach the destination or if its occupied /// </summary> private static bool NewDestinationNeeded(FractionalHex startPos, Hex end, RuntimeMap map, out Hex newDestination) { Hex startHex = startPos.Round(); newDestination = end; bool destinationIsAvalible = MapUtilities.HexIsOpenAndReachable(startHex, end, map.UnitsMapValues);// HexIsFreeAndReachable(startHex, end, map); if (!destinationIsAvalible) { MapUtilities.TryFindClosestOpenAndReachableHex(out newDestination, (FractionalHex)end, (FractionalHex)startHex, map.UnitsMapValues); return(true); } else { return(false); } }