public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            serializedObject.Update();

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Center", GUILayout.MaxWidth(buttonMaxWidth)))
            {
                BiomeMaskUtils.CenterMainHandle(mask);
            }
            else if (GUILayout.Button("Grow", GUILayout.MaxWidth(buttonMaxWidth)))
            {
                BiomeMaskUtils.Grow(mask, resizeFactor);
            }
            else if (GUILayout.Button("Shrink", GUILayout.MaxWidth(buttonMaxWidth)))
            {
                BiomeMaskUtils.Shrink(mask, -resizeFactor);
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Circle", GUILayout.MaxWidth(buttonMaxWidth)))
            {
                BiomeMaskUtils.CreateCircle(mask);
            }
            else if (GUILayout.Button("Hexagon", GUILayout.MaxWidth(buttonMaxWidth)))
            {
                BiomeMaskUtils.CreateHexagon(mask);
            }
            else if (GUILayout.Button("Convex Hull", GUILayout.MaxWidth(buttonMaxWidth)))
            {
                BiomeMaskUtils.ConvexHull(mask);
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Subdivide", GUILayout.MaxWidth(buttonMaxWidth)))
            {
                BiomeMaskUtils.Subdivide(mask);
            }
            else if (GUILayout.Button("Unsubdivide", GUILayout.MaxWidth(buttonMaxWidth)))
            {
                BiomeMaskUtils.Unsubdivide(mask);
            }

            GUILayout.EndHorizontal();

            serializedObject.ApplyModifiedProperties();
        }
Example #2
0
        private void GrowAll()
        {
            // get all biome mask area gameobjects of this gameobject
            GameObject parentGo = editor.extension.transform.gameObject;

            BiomeMaskArea[] masks = parentGo.GetComponentsInChildren <BiomeMaskArea>();

            foreach (BiomeMaskArea mask in masks)
            {
                BiomeMaskUtils.Grow(mask, resizeFactor);
            }
        }