static void Game_OnGameUpdate(EventArgs args) { if (_mainMenu.Item("zoomIn").GetValue <KeyBind>().Active) { _size -= 5; } if (_mainMenu.Item("zoomOut").GetValue <KeyBind>().Active) { _size += 5; } if (!_mainMenu.Item("scan").GetValue <KeyBind>().Active) { _scan = true; } if (_mainMenu.Item("Enable").GetValue <bool>() && _mainMenu.Item("scan").GetValue <KeyBind>().Active&& _scan) { var currentPostion = Game.CursorPos.To2D(); var tempList = new List <Geometry.Polygon>(); var rect = new Geometry.Polygon.Rectangle(new Vector2(0, 0), new Vector2(0, 5), 5f); for (int x = -_size; x < _size; x += 5) { for (int y = -_size; y < _size; y += 5) { var test = rect.MovePolygone(new Vector2(currentPostion.X + x, currentPostion.Y + y)); if (NavMesh.GetCollisionFlags(test.Points[0].To3D()).HasFlag(CollisionFlags.Building) && _mainMenu.Item("building").GetValue <bool>()) { tempList.Add(test); } if (NavMesh.GetCollisionFlags(test.Points[0].To3D()).HasFlag(CollisionFlags.Grass) && _mainMenu.Item("grass").GetValue <bool>()) { tempList.Add(test); } if (NavMesh.GetCollisionFlags(test.Points[0].To3D()).HasFlag(CollisionFlags.Wall) && _mainMenu.Item("wall").GetValue <bool>()) { tempList.Add(test); } } } var temp = Geometry.ClipPolygons(tempList); temp.TrimExcess(); foreach (var polygone in temp) { _polygoneList.Add(polygone.ToPolygon()); } _scan = false; } if (_mainMenu.Item("clip").GetValue <KeyBind>().Active) { _polygoneList = _polygoneList.JoinPolygons(); } }