Пример #1
0
        private void OnBoxSelection(object sender, BoxSelectionArgs e)
        {
            IMeshEditor meshEditor = m_meshEditors[(int)m_mode];

            if (meshEditor == null)
            {
                return;
            }

            RuntimeWindow window = m_rte.ActiveWindow;

            Vector2       min  = m_boxSelection.SelectionBounds.min;
            Vector2       max  = m_boxSelection.SelectionBounds.max;
            RectTransform rt   = window.GetComponent <RectTransform>();
            Rect          rect = new Rect(new Vector2(min.x, rt.rect.height - max.y), m_boxSelection.SelectionBounds.size);

            MeshSelection selection = meshEditor.Select(window.Camera, rect, e.GameObjects.Where(g => g.GetComponent <ExposeToEditor>() != null).ToArray(), MeshEditorSelectionMode.Add);

            m_rte.Undo.BeginRecord();

            if (selection != null)
            {
                RecordSelection(meshEditor, selection);
            }

            m_pivot.position = meshEditor.Position;
            m_pivot.rotation = GetPivotRotation(meshEditor);

            TrySelectPivot(meshEditor);

            m_rte.Undo.EndRecord();
        }
Пример #2
0
 public static void InitializeIfRequired(RuntimeWindow window, ref RuntimeHandlesHitTester hitTester)
 {
     hitTester = window.GetComponent <RuntimeHandlesHitTester>();
     if (!hitTester)
     {
         hitTester = window.gameObject.AddComponent <RuntimeHandlesHitTester>();
     }
 }