Esempio n. 1
0
        protected override void OnNodeInspectorGUI()
        {
            ShowBaseFSMInspectorGUI();
            NodeCanvas.Editor.BBParameterEditor.ParameterField("NestedGraphOwner", NestedGraphOwner);
            NodeCanvas.Editor.BBParameterEditor.ParameterField("BehaviourTree", _nestedBT);

            if (nestedBT == null)
            {
                return;
            }
            //nestedBT.name = this.name;

            executionMode = (BTExecutionMode)EditorGUILayout.EnumPopup("Execution Mode", executionMode);
            exitMode      = (BTExitMode)EditorGUILayout.EnumPopup("Exit Mode", exitMode);

            var alpha1 = string.IsNullOrEmpty(successEvent) ? 0.5f : 1;
            var alpha2 = string.IsNullOrEmpty(failureEvent) ? 0.5f : 1;

            GUILayout.BeginVertical("box");
            GUI.color    = new Color(1, 1, 1, alpha1);
            successEvent = EditorGUILayout.TextField("Success Status Event", successEvent);
            GUI.color    = new Color(1, 1, 1, alpha2);
            failureEvent = EditorGUILayout.TextField("Failure Status Event", failureEvent);
            GUILayout.EndVertical();
            GUI.color = Color.white;

            var defParams = nestedBT.GetDefinedParameters();

            if (defParams.Length != 0)
            {
                EditorUtils.TitledSeparator("Defined Nested BT Parameters");
                GUI.color = Color.yellow;
                EditorGUILayout.LabelField("Name", "Type");
                GUI.color = Color.white;
                var added = new List <string>();
                foreach (var bbVar in defParams)
                {
                    if (!added.Contains(bbVar.name))
                    {
                        EditorGUILayout.LabelField(bbVar.name, bbVar.varType.FriendlyName());
                        added.Add(bbVar.name);
                    }
                }
                if (GUILayout.Button("Check/Create Blackboard Variables"))
                {
                    nestedBT.PromoteDefinedParametersToVariables(graphBlackboard);
                }
            }
            //---------------------更新Asset资源名称

            if (!Application.isPlaying && GUILayout.Button("RefreshAssetName"))
            {
                nestedBT.name = name;
                if (AssetDatabase.IsMainAsset(nestedBT) || AssetDatabase.IsSubAsset(nestedBT))
                {
                    AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(nestedBT));
                }
            }
        }
Esempio n. 2
0
        protected override void OnNodeInspectorGUI()
        {
            ShowBaseFSMInspectorGUI();
            EditorUtils.BBParameterField("Behaviour Tree", _nestedBT);

            if (nestedBT == null)
            {
                return;
            }

            executionMode = (BTExecutionMode)EditorGUILayout.EnumPopup("Execution Mode", executionMode);
            exitMode      = (BTExitMode)EditorGUILayout.EnumPopup("Exit Mode", exitMode);

            var alpha1 = string.IsNullOrEmpty(successEvent)? 0.5f : 1;
            var alpha2 = string.IsNullOrEmpty(failureEvent)? 0.5f : 1;

            GUILayout.BeginVertical("box");
            GUI.color    = new Color(1, 1, 1, alpha1);
            successEvent = EditorGUILayout.TextField("Success Status Event", successEvent);
            GUI.color    = new Color(1, 1, 1, alpha2);
            failureEvent = EditorGUILayout.TextField("Failure Status Event", failureEvent);
            GUILayout.EndVertical();
            GUI.color = Color.white;

            nestedBT.name = name;


            var defParams = nestedBT.GetDefinedParameters();

            if (defParams.Length != 0)
            {
                EditorUtils.TitledSeparator("Defined Nested BT Parameters");
                GUI.color = Color.yellow;
                EditorGUILayout.LabelField("Name", "Type");
                GUI.color = Color.white;
                var added = new List <string>();
                foreach (var bbVar in defParams)
                {
                    if (!added.Contains(bbVar.name))
                    {
                        EditorGUILayout.LabelField(bbVar.name, bbVar.varType.FriendlyName());
                        added.Add(bbVar.name);
                    }
                }
                if (GUILayout.Button("Check/Create Blackboard Variables"))
                {
                    nestedBT.CreateDefinedParameterVariables(graphBlackboard);
                }
            }
        }
Esempio n. 3
0
        protected override void OnNodeInspectorGUI()
        {
            ShowBaseFSMInspectorGUI();
            EditorUtils.BBParameterField("Behaviour Tree", _nestedBT);

            if (nestedBT == null){
                return;
            }

            executionMode = (BTExecutionMode)EditorGUILayout.EnumPopup("Execution Mode", executionMode);
            exitMode = (BTExitMode)EditorGUILayout.EnumPopup("Exit Mode", exitMode);

            var alpha1 = string.IsNullOrEmpty(successEvent)? 0.5f : 1;
            var alpha2 = string.IsNullOrEmpty(failureEvent)? 0.5f : 1;
            GUILayout.BeginVertical("box");
            GUI.color = new Color(1,1,1,alpha1);
            successEvent = EditorGUILayout.TextField("Success Status Event", successEvent);
            GUI.color = new Color(1,1,1,alpha2);
            failureEvent = EditorGUILayout.TextField("Failure Status Event", failureEvent);
            GUILayout.EndVertical();
            GUI.color = Color.white;

            nestedBT.name = name;

            var defParams = nestedBT.GetDefinedParameters();
            if (defParams.Length != 0){

                EditorUtils.TitledSeparator("Defined Nested BT Parameters");
                GUI.color = Color.yellow;
                EditorGUILayout.LabelField("Name", "Type");
                GUI.color = Color.white;
                var added = new List<string>();
                foreach(var bbVar in defParams){
                    if (!added.Contains(bbVar.name)){
                        EditorGUILayout.LabelField(bbVar.name, bbVar.varType.FriendlyName());
                        added.Add(bbVar.name);
                    }
                }
                if (GUILayout.Button("Check/Create Blackboard Variables")){
                    nestedBT.CreateDefinedParameterVariables(graphBlackboard);
                }
            }
        }