示例#1
0
        /// <summary>
        /// Executes the action.
        /// </summary>
        public void Execute()
        {
            if (_gameObjects.Count != 0)
            {
                // Take a snapshot to allow for undo
                _preChangeMaskSnapshot = new ObjectSelectionMaskSnapshot();
                _preChangeMaskSnapshot.TakeSnapshot();

                // Remove the objects from the selection mask.
                EditorObjectSelection editorObjectSelection = EditorObjectSelection.Instance;
                editorObjectSelection.RemoveGameObjectCollectionFromSelectionMask(_gameObjects);

                // Take a snapshot to allow for redo
                _postChangeMaskSnapshot = new ObjectSelectionMaskSnapshot();
                _postChangeMaskSnapshot.TakeSnapshot();

                ObjectsRemovedFromSelectionMaskMessage.SendToInterestedListeners(_gameObjects);
                EditorUndoRedoSystem.Instance.RegisterAction(this);
            }
        }
        /// <summary>
        /// Convenience function for sending an objects removed from selection mask message to
        /// all interested listeners.
        /// </summary>
        /// <param name="gameObjects">
        /// The game objects which were removed from the selection mask.
        /// </param>
        public static void SendToInterestedListeners(List <GameObject> gameObjects)
        {
            var message = new ObjectsRemovedFromSelectionMaskMessage(gameObjects);

            MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message);
        }