public override void OnBodyGUI() { _statesIn = serializedObject.FindProperty("statesIn"); if (Selection.activeObject == _node) { var optionsList = _node.graph.nodes .OfType <AIBrainStateNode>() .Select(node => node.name) .ToList(); optionsList.AddRange(_node.graph.nodes .OfType <AIBrainSubgraphNode>() .SelectMany(node => node.inputStates .Select(inputState => GeneratorUtils.GetSubgraphStateName(node.name, inputState.fieldName)))); if (optionsList.Count > 0) { var options = optionsList.ToArray(); _stateIndex = EditorGUILayout.Popup(_stateIndex, options); EditorGUILayout.Space(); _node.stateName = options[_stateIndex]; } else { EditorGUILayout.LabelField(C.LABEL_NO_STATE_AVAILABLE); EditorGUILayout.Space(); } } serializedObject.Update(); NodeEditorGUILayout.PropertyField(_statesIn); serializedObject.ApplyModifiedProperties(); }
/// <summary> /// Returns the label for the transition False state. /// </summary> /// <returns>The transition False state label</returns> public string GetFalseStateLabel() { var connection = GetOutputPort(C.PORT_FALSE_STATE).Connection; if (connection == null) { return(""); } if (!(GetOutputPort(C.PORT_FALSE_STATE).Connection.node is AIBrainSubgraphNode)) { return(connection.node.name); } var label = GeneratorUtils.GetSubgraphStateName(connection.node.name, connection.fieldName.Split('-')[0]); return(label); }