示例#1
0
        public void SetBool(Node node, bool value)
        {
            BoolNode n = node as BoolNode;

            if (n == null)
            {
                throw new System.Exception("Wrong type");
            }
            n.Value = value;
        }
示例#2
0
        public bool GetBool(Node node)
        {
            BoolNode n = node as BoolNode;

            if (n == null)
            {
                throw new System.Exception("Wrong type");
            }
            return(n.Value);
        }
示例#3
0
        public NodeBase CreateNode(NodeType nodeType, Vector2 mousePos)
        {
            if (curGraph != null)
            {
                NodeBase curNode = null;
                switch (nodeType)
                {
                case NodeType.Text:
                    curNode          = new TextNode();
                    curNode.nodeName = "New Text";
                    break;

                case NodeType.Dialog:
                    curNode          = new DialogNode();
                    curNode.nodeName = "New Dialog";
                    break;

                case NodeType.Branching:
                    curNode          = new BranchingNode();
                    curNode.nodeName = "Branching Dialog";
                    break;

                case NodeType.Start:
                    curNode          = new StartNode();
                    curNode.nodeName = "New Start";
                    break;

                case NodeType.End:
                    curNode          = new EndNode();
                    curNode.nodeName = "New End";
                    break;

                case NodeType.Bool:
                    curNode          = new BoolNode();
                    curNode.nodeName = "Bool Node";
                    break;

                default:
                    break;
                }

                if (curNode != null)
                {
                    curNode.parentGraph = curGraph;
                    curGraph.nodes.Add(curNode);

                    curNode.InitNode();
                    curNode.nodeRect.x = mousePos.x;
                    curNode.nodeRect.y = mousePos.y;
                }
                return(curNode);
            }
            return(null);
        }