/// <summary> /// finds the first "Impact point" casting a line toward this object /// </summary> /// <returns>A relative point, or null for no intersect</returns> public Point?CastTo(Vector2[] RelativeLine) { foreach (Point p in LocationManager.AllPointsThroughGrid(RelativeLine, 1)) { if (p.X >= 0 && p.X < livemap.GetLength(0) && p.Y >= 0 && p.Y < livemap.GetLength(1) && livemap[p.X, p.Y]) { return(p); } } return(null); }