Exemplo n.º 1
0
        public void OnEnable()
        {
            this.editor = this;

            container = FindProperty(x => x.container);
            mode      = FindProperty(x => x.mode);

            this.editorTarget = target as PrefabPainter;

            this.brushModule       = new BrushModuleEditor(this);
            this.splineModule      = new SplineModuleEditor(this);
            this.interactionModule = new InteractionModuleEditor(this);
            this.containerModule   = new ContainerModuleEditor(this);
            this.prefabModule      = new PrefabModuleEditor(this);
            this.physicsModule     = new PhysicsExtension(this);
            this.copyPasteModule   = new CopyPasteExtension(this);
            this.selectionModule   = new SelectionExtension(this);
            this.toolsModule       = new ToolsExtension(this);
            this.spawnModule       = new SpawnExtension(this);
            this.filterModule      = new FilterExtension(this);

            modeButtons = new GUIContent[]
            {
                // TODO: icons
                new GUIContent("Brush", "Paint prefabs using a brush"),
                new GUIContent("Spline", "Align prefabs along a spline"),
                new GUIContent("Interaction", "Brush interaction on the container children"),
                new GUIContent("Operations", "Operations on the container"),
            };

            // subscribe to play mode state changes
            EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
            EditorApplication.playModeStateChanged += OnPlayModeStateChanged;

            // subscribe to scene gui changes
            SceneView.duringSceneGui -= OnSceneGUI;
            SceneView.duringSceneGui += OnSceneGUI;

            brushModule.OnEnable();
            splineModule.OnEnable();
            interactionModule.OnEnable();
            containerModule.OnEnable();
        }