private void ToggleObjectSelectedState(GameObject gameObject)
        {
            ObjectSelection           objectSelection     = ObjectSelection.Get();
            ObjectSelectionUpdateMode selectionUpdateMode = ObjectSelectionSettings.Get().SelectionUpdateMode;

            UndoEx.RecordForToolAction(objectSelection);

            if (selectionUpdateMode == ObjectSelectionUpdateMode.EntireHierarchy)
            {
                if (objectSelection.IsGameObjectSelected(gameObject))
                {
                    objectSelection.RemoveEntireGameObjectHierarchyFromSelection(gameObject);
                }
                else
                {
                    objectSelection.AddEntireGameObjectHierarchyToSelection(gameObject);
                }
            }
            else
            {
                if (objectSelection.IsGameObjectSelected(gameObject))
                {
                    objectSelection.RemoveGameObjectFromSelection(gameObject);
                }
                else
                {
                    objectSelection.AddGameObjectToSelection(gameObject);
                }
            }
            objectSelection.ObjectSelectionGizmos.OnObjectSelectionUpdatedUsingMouseClick();
        }
Пример #2
0
        public static void InvertSelection()
        {
            List <GameObject> allWorkingObjects = Octave3DWorldBuilder.ActiveInstance.GetAllWorkingObjects();
            List <GameObject> objectsToSelect   = new List <GameObject>();
            ObjectSelection   objectSelection   = ObjectSelection.Get();

            foreach (var gameObject in allWorkingObjects)
            {
                if (!objectSelection.IsGameObjectSelected(gameObject))
                {
                    objectsToSelect.Add(gameObject);
                }
            }

            objectSelection.Clear();
            objectSelection.AddGameObjectCollectionToSelection(objectsToSelect);
            objectSelection.ObjectSelectionGizmos.OnObjectSelectionUpdated();
        }