Пример #1
0
 public override void Update()
 {
     // Auto snapping position
     if (BlockoutEditorSettings.AutoSnap &&
         !EditorApplication.isPlaying &&
         Selection.transforms.Length > 0 &&
         Selection.transforms[0].position != prevPosition)
     {
         if ((Selection.transforms[0].position - prevPosition).magnitude > snapValue)
         {
             prevPosition       = Selection.transforms[0].position;
             previousObjectMain = currentObjectMain;
             currentObjectMain  = Selection.transforms[0].gameObject;
         }
         else if (previousObjectMain != null)
         {
             BlockoutStaticFunctions.SnapPositionSelection();
             prevPosition = Selection.transforms[0].position;
         }
     }
     // Auto snapping scale
     if (BlockoutEditorSettings.AutoSnap &&
         !EditorApplication.isPlaying &&
         Selection.transforms.Length > 0 &&
         Selection.transforms[0].lossyScale != prevScale)
     {
         if ((Selection.transforms[0].lossyScale - prevScale).magnitude > snapValue)
         {
             prevScale          = Selection.transforms[0].lossyScale;
             previousObjectMain = currentObjectMain;
             currentObjectMain  = Selection.transforms[0].gameObject;
         }
         else if (previousObjectMain != null)
         {
             BlockoutStaticFunctions.SnapScaleSelection();
             prevScale = Selection.transforms[0].lossyScale;
         }
     }
 }