SecuenceNode.addNewChild C# (CSharp) Method

addNewChild() public method

public addNewChild ( ) : SecuenceNode,
return SecuenceNode,
    public SecuenceNode addNewChild()
    {
        SecuenceNode node = ScriptableObject.CreateInstance<SecuenceNode>();
        node.init ();
        this.childs.Add(node);
        return node;
    }

Usage Example

Ejemplo n.º 1
0
    public void draw()
    {
        dialog = myNode.Content as Dialog;

        GUIStyle style = new GUIStyle();

        style.padding = new RectOffset(5, 5, 5, 5);
        dialog.id     = UnityEditor.EditorGUILayout.TextField("Name", dialog.id);

        ArrayList lf = new ArrayList(dialog.getFragments());

        fragmentsReorderableList.list = lf;

        ArrayList lo = new ArrayList(dialog.getOptions());

        optionsReorderableList.list = lo;

        EditorGUILayout.HelpBox("You have to add at least one", MessageType.None);
        if (fragmentsReorderableList.list != null)
        {
            bool isScrolling = false;
            if (fragmentsReorderableList.list.Count > 3)
            {
                scroll      = EditorGUILayout.BeginScrollView(scroll, GUILayout.ExpandWidth(true), GUILayout.Height(250));
                isScrolling = true;
            }

            fragmentsReorderableList.elementHeight = fragmentsReorderableList.list.Count == 0 ? 20 : 70;
            fragmentsReorderableList.DoLayoutList();

            if (isScrolling)
            {
                EditorGUILayout.EndScrollView();
            }
        }

        EditorGUILayout.HelpBox("Options are the lines between you have to choose at the end of the dialog. Leave empty to do nothing, put one to execute this as the dialog ends, or put more than one to let the player choose between them.", MessageType.None);
        if (optionsReorderableList.list != null)
        {
            int i = optionsReorderableList.count;
        }

        optionsReorderableList.DoLayoutList();

        if (Event.current.type != EventType.layout)
        {
            if (myNode.Childs.Length < 1)
            {
                myNode.addNewChild();
                //this.Repaint ();
            }
        }
    }
All Usage Examples Of SecuenceNode::addNewChild