private Vector2 searchBoolFields() { Vector2 d = (aim - position); d.Normalize(); Vector2 currP = position; float t = 0; while (currP.X >= 0 && currP.X < field.Width && currP.Y >= 0 && currP.Y < field.Height) { currP = position + d * t; t += 0.1f; int x = (int)currP.X; int y = (int)currP.Y; var v = currP; //cnew Vector2(x, y); if ( //field.field[(int)x, (int)y] || field.field[(int)x-1, (int)y] || field.field[(int)x+1, (int)y] || //field.field[(int)x, (int)y+1] || field.field[(int)x, (int)y-1] field.TestIntersect(new Rectangle(x - 2, y - 2, 4, 4)) ) { hitWall = true; return(v); } else { foreach (Actor actor in _parentActor.ParentLevel.Actors) { if (actor.CollisionClass != -1 && actor != _parentActor && (actor.Position - v).Length() < actor.BoundingBox.Width) { hitWall = false; hitActor = actor; return(v); } } } } throw new Exception("Unbounded Map"); }