Esempio n. 1
0
        private void OnEnable()
        {
            editor = (MarchingSquaresEditorComponent)target;

            if (meshers == null)
            {
                meshers = new List <EditorMesher>();
            }
            meshers.Clear();

            CreateMeshers();

            if (editor.DataComponent != null && editor.DataComponent.Data == null)
            {
                editor.DataComponent.Load();
            }

            props = new ComponentProperties <PropName>(serializedObject);

            editMode              = EditorPrefs.GetBool(PrefEditMode, false);
            showGrid              = EditorPrefs.GetBool(PrefShowGrid, true);
            brushModeIndex        = EditorPrefs.GetInt(PrefBrushModeIndex, 0);
            brushShapeIndex       = EditorPrefs.GetInt(PrefBrushShapeIndex, 0);
            heightBrushModeIndex  = EditorPrefs.GetInt(PrefHeightBrushModeIndex, 0);
            heightChangeModeIndex = EditorPrefs.GetInt(PrefHeightChangeModeIndex, 0);
            heightBrushFoldout    = EditorPrefs.GetBool(PrefHeightBrushFoldout, false);
            removeBorder          = EditorPrefs.GetBool(PrefRemoveBorder, false);
            autoSave              = EditorPrefs.GetBool(PrefAutoSave, false);

            SceneView.beforeSceneGui -= BeforeSceneGUI;
            SceneView.beforeSceneGui += BeforeSceneGUI;
        }
Esempio n. 2
0
        private void DrawAt(float x, float y)
        {
            if (editor.EditMode == Mode.HeightChange && !Data.HasHeights)
            {
                return;
            }

            MarchingSquaresEditorComponent.DrawAt(x, y, Data, editor);

            if (removeBorder)
            {
                Data.RemoveBorder();
            }

            Regenerate();
        }