Esempio n. 1
0
        public static void Init()
        {
            ObsEditWindow window = (ObsEditWindow)EditorWindow.GetWindow(typeof(ObsEditWindow));

            window.titleContent = new GUIContent("Obs Edit Tools");
            window.minSize      = new Vector2(100, 38);
            window.maxSize      = window.minSize;
            window.Show();
        }
        void DrawGeneralArea()
        {
            bool usePhysics = EditorGUILayout.ToggleLeft(new GUIContent("Use Physics 2D", "Calculate 2D colliders."), manager.UsePhysics2D);

            EditorPrefs.SetBool("showObstacleEditingSettigs", showObstacleEditingSettigs);

            if (usePhysics != manager.UsePhysics2D)
            {
                manager.UsePhysics2D = usePhysics;
                manager.CalculateColliders();
                SceneView.RepaintAll();
            }

            EditorGUI.indentLevel = 1;
            if (usePhysics)
            {
                SerializedProperty collisionTags = serializedObject.FindProperty("IgnoreCollisionTags");
                EditorGUILayout.PropertyField(collisionTags, true);
            }

            showObstacleEditingSettigs = EditorGUILayout.Foldout(showObstacleEditingSettigs, "Manual Obstacle Editing");
            EditorPrefs.SetBool("showObstacleCalculation", showObstacleEditingSettigs);

            if (showObstacleEditingSettigs)
            {
                float y = EditorGUILayout.BeginVertical().y;
                SAP2DManager.singleton.grid.brushSize = EditorGUILayout.IntSlider("Brush Size", SAP2DManager.singleton.grid.brushSize, 1, 10);
                if (GUI.Button(new Rect(30, y + 16, 110, 15), "Open Tools Panel", EditorStyles.miniButton))
                {
                    ObsEditWindow.Init();
                }
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUILayout.EndVertical();
            }
            EditorGUI.indentLevel = 0;
        }