コード例 #1
0
 public List <GameObject> GetOverlappedGameObjects()
 {
     if (ObjectSelectionSettings.Get().SelectionMode == ObjectSelectionMode.Standard)
     {
         // Note: We will only select objects if at least one of the enclosing rectangle dimensions
         //       is >= 'minRectSize'. This helps avoid situations in which the user wants to click on
         //       a game object, but they accodentally drag the mouse a little bit which causes unwanted
         //       objects to be selected.
         const int minRectSize          = 15;
         ObjectInteraction2DShape shape = GetShape();
         Rect enclosingRectangle        = shape.EnclosingRect;
         if (Mathf.Abs(enclosingRectangle.size.x) >= minRectSize ||
             Mathf.Abs(enclosingRectangle.size.y) >= minRectSize)
         {
             return(shape.GetOverlappedGameObjects(ObjectSelectionSettings.Get().AllowPartialOverlap));
         }
         else
         {
             return(new List <GameObject>());
         }
     }
     else
     {
         return(GetShape().GetOverlappedGameObjects(ObjectSelectionSettings.Get().AllowPartialOverlap));
     }
 }
コード例 #2
0
        private void AdjustStandardShapeSizeForMouseDragEvent(Event e)
        {
            ObjectInteraction2DShape shape = GetShape();

            shape.SetEnclosingRectMaxPoint(e.InvMousePos(SceneViewCamera.Camera));

            SceneView.RepaintAll();
        }