Exemplo n.º 1
0
        public FTNode GetChildNode(int index)
        {
            FTConnection bc = GetChildConnection(index);

            return(bc != null ? bc.ConnectNode : null);
        }
Exemplo n.º 2
0
        private void DrawStateNode(int maxChildCount)
        {
            int childCount = _FTNode.ChildCount;

            for (int i = 0; i < childCount; i++)
            {
                FTConnection connection = _FTNode.GetChildConnection(i);
                NodePort     port       = target.GetOutputPort(connection.portName);
                NodePort     connected  = port.Connection;

                if (connected == null)
                {
                    _FTNode.RemoveChildConnection(i);
                    i--;
                    childCount--;
                }
                else
                {
                    //GUILayout.BeginArea(new Rect(50f, 50f + i * 100f, 100f, 100f));
                    EditorGUILayout.BeginVertical("Box");
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.Space();
                        NodeEditorGUILayout.PortField(new GUIContent("To" + (i + 1)), port, GUILayout.Width(50));
                        EditorGUILayout.EndHorizontal();

                        // GUILayout.Button("XXX");
                        var           fsms  = FTUtils.GetFSMTransitionMethod("ActorFSM");
                        List <string> names = new List <string>();
                        foreach (var tp  in fsms)
                        {
                            names.Add(tp.ToString());
                        }

                        EditorGUILayout.Popup(0, names.ToArray());
                    }
                    EditorGUILayout.EndVertical();
                    //GUILayout.EndArea();
                }
            }

            // if (NodeEditorWindow.mode == NodeEditorMode.Edit && childCount < maxChildCount)
            if (childCount < maxChildCount)
            {
                _outputNewChild = target.GetOutputPort(OUTPUT_PORT_NEWCHILD);
                if (_outputNewChild == null)
                {
                    _outputNewChild = target.AddDynamicOutput(typeof(FTConnection), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, OUTPUT_PORT_NEWCHILD);
                }

                if (_outputNewChild.Connection != null)
                {
                    _FTNode.AddChildConnection(_outputNewChild.Connection);
                    _outputNewChild.Disconnect(_outputNewChild.Connection);
                    EditorUtility.SetDirty(target);
                }

                GUILayout.BeginHorizontal();
                EditorGUILayout.Space();
                NodeEditorGUILayout.PortField(_outputNewChild, GUILayout.Width(80));
                GUILayout.EndHorizontal();
            }
        }