Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox(m_OverPoint != -1 ? "Press Control and click to remove the point." : "Press Control and click to add a walkable point.", m_Target.m_WalkablePoint.Count == 0 ? MessageType.Warning : MessageType.Info);

            base.OnInspectorGUI();

            NavMeshCleaner t = (NavMeshCleaner)target;

            if (GUILayout.Button(t.HasMesh() ? "Recalculate" : "Calculate", GUILayout.Height(30.0f)))
            {
                t.Build();
                t.SetMeshVisible(true);
                SceneView.RepaintAll();
            }

            if (t.HasMesh() && GUILayout.Button(t.MeshVisible() ? "Hide Mesh" : "Show Mesh", GUILayout.Height(30.0f)))
            {
                StaticEditorFlags flags = GameObjectUtility.GetStaticEditorFlags(t.gameObject);
                bool enabled            = !t.MeshVisible();
                t.SetMeshVisible(enabled);
                SceneView.RepaintAll();
            }
            if (t.HasMesh() && GUILayout.Button("Reset Mesh", GUILayout.Height(30.0f)))
            {
                t.Reset();
                SceneView.RepaintAll();
            }
            if (t.HasMesh() && GUILayout.Button("Reset WalkablePoints", GUILayout.Height(30.0f)))
            {
                Undo.RecordObject(target, "reset");
                m_Target.m_WalkablePoint.Clear();
                SceneView.RepaintAll();
            }
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox(m_OverPoint != -1 ? "Press Control and click to remove the point." : "Press Control and click to add a walkable point.", m_Target.m_WalkablePoint.Count == 0 ? MessageType.Warning : MessageType.Info);

            base.OnInspectorGUI();

            NavMeshCleaner t = (NavMeshCleaner)target;

            if (t.m_Child.Count > 0)
            {
                EditorGUI.BeginChangeCheck();
                bool hideInHierarchy = EditorGUILayout.Toggle("Hide Temp Mesh Object In Hierarchy", (t.m_Child[0].gameObject.hideFlags & HideFlags.HideInHierarchy) != 0 ? true : false);
                if (EditorGUI.EndChangeCheck())
                {
                    for (int i = 0; i < t.m_Child.Count; i++)
                    {
                        t.m_Child[i].gameObject.hideFlags = hideInHierarchy ? (t.m_Child[i].gameObject.hideFlags | HideFlags.HideInHierarchy) : (t.m_Child[i].gameObject.hideFlags & (~HideFlags.HideInHierarchy));
                    }
                    try
                    {
                        EditorApplication.RepaintHierarchyWindow();
                        EditorApplication.DirtyHierarchyWindowSorting();
                    }
                    catch { }
                }
            }

            if (GUILayout.Button(t.HasMesh() ? "Recalculate" : "Calculate", GUILayout.Height(30.0f)))
            {
                //t.Reset();
                t.Build();
                t.SetMeshVisible(true);
                SceneView.RepaintAll();
            }

            if (t.HasMesh() && GUILayout.Button(t.MeshVisible() ? "Hide Mesh" : "Show Mesh", GUILayout.Height(30.0f)))
            {
                //StaticEditorFlags flags = GameObjectUtility.GetStaticEditorFlags(t.gameObject);
                bool enabled = !t.MeshVisible();
                t.SetMeshVisible(enabled);
                SceneView.RepaintAll();
            }
            if (t.HasMesh() && GUILayout.Button("Reset Mesh", GUILayout.Height(30.0f)))
            {
                t.Reset();
                SceneView.RepaintAll();
            }
            if (t.HasMesh() && GUILayout.Button("Reset WalkablePoints", GUILayout.Height(30.0f)))
            {
                Undo.RecordObject(target, "reset");
                m_Target.m_WalkablePoint.Clear();
                SceneView.RepaintAll();
            }
        }
Esempio n. 3
0
        void OnEnable()
        {
            m_Target = (NavMeshCleaner)target;

            Undo.undoRedoPerformed += OnUndoOrRedo;
        }