public static Point[] GetValidAdjacentPoints(Point point, bool diagonalPathing = true, bool honorBlocking = true) { List <Point> points = new List <Point>(); var north = DirectionToPoint(Direction.North) + point; var east = DirectionToPoint(Direction.East) + point; var south = DirectionToPoint(Direction.South) + point; var west = DirectionToPoint(Direction.West) + point; if (MiniScreen.IsValidScreenPosition(north, honorBlocking)) { points.Add(north); } if (MiniScreen.IsValidScreenPosition(east, honorBlocking)) { points.Add(east); } if (MiniScreen.IsValidScreenPosition(south, honorBlocking)) { points.Add(south); } if (MiniScreen.IsValidScreenPosition(west, honorBlocking)) { points.Add(west); } if (diagonalPathing) { var northeast = DirectionToPoint(Direction.NorthEast) + point; var southeast = DirectionToPoint(Direction.SouthEast) + point; var southwest = DirectionToPoint(Direction.SouthWest) + point; var northwest = DirectionToPoint(Direction.NorthWest) + point; if (MiniScreen.IsValidScreenPosition(northeast, honorBlocking)) { points.Add(northeast); } if (MiniScreen.IsValidScreenPosition(southeast, honorBlocking)) { points.Add(southeast); } if (MiniScreen.IsValidScreenPosition(southwest, honorBlocking)) { points.Add(southwest); } if (MiniScreen.IsValidScreenPosition(northwest, honorBlocking)) { points.Add(northwest); } } return(points.ToArray()); }
public static bool IsNextToInvalidPoint(Point point, bool diagonalPathing = true, bool honorBlocking = true) { List <Point> points = new List <Point>(); var north = DirectionToPoint(Direction.North) + point; var east = DirectionToPoint(Direction.East) + point; var south = DirectionToPoint(Direction.South) + point; var west = DirectionToPoint(Direction.West) + point; if (!MiniScreen.IsValidScreenPosition(north, honorBlocking)) { return(true); } if (!MiniScreen.IsValidScreenPosition(east, honorBlocking)) { return(true); } if (!MiniScreen.IsValidScreenPosition(south, honorBlocking)) { return(true); } if (!MiniScreen.IsValidScreenPosition(west, honorBlocking)) { return(true); } if (diagonalPathing) { var northeast = DirectionToPoint(Direction.NorthEast) + point; var southeast = DirectionToPoint(Direction.SouthEast) + point; var southwest = DirectionToPoint(Direction.SouthWest) + point; var northwest = DirectionToPoint(Direction.NorthWest) + point; if (!MiniScreen.IsValidScreenPosition(northeast, honorBlocking)) { return(true); } if (!MiniScreen.IsValidScreenPosition(southeast, honorBlocking)) { return(true); } if (!MiniScreen.IsValidScreenPosition(southwest, honorBlocking)) { return(true); } if (!MiniScreen.IsValidScreenPosition(northwest, honorBlocking)) { return(true); } } return(false); }