private Node CreateNode(NodeConfig config)
 {
     if (!this.dictionary.ContainsKey(config.Id))
     {
         throw new KeyNotFoundException(string.Format("CreateNode cannot found: {0}", config.Id));
     }
     return(this.dictionary[config.Id](config));
 }
        private Node CreateOneNode(NodeConfig proto)
        {
            NodeType nodeType = proto.Type;

            if (!this.dictionary.ContainsKey(nodeType))
            {
                throw new KeyNotFoundException($"NodeType没有定义该节点: {nodeType}");
            }
            return(this.dictionary[nodeType](proto));
        }
        private Node CreateTreeNode(NodeConfig proto)
        {
            Node node = this.CreateOneNode(proto);

            if (proto.Children == null)
            {
                return(node);
            }

            foreach (NodeConfig nodeProto in proto.Children)
            {
                Node childNode = this.CreateTreeNode(nodeProto);
                node.AddChild(childNode);
            }
            return(node);
        }
        private Node CreateTreeNode(NodeConfig config)
        {
            var node = this.CreateNode(config);

            if (config.SubConfigs == null)
            {
                return(node);
            }

            foreach (var subConfig in config.SubConfigs)
            {
                var subNode = this.CreateTreeNode(subConfig);
                node.AddChild(subNode);
            }
            return(node);
        }
示例#5
0
		public Selector(NodeConfig config): base(config)
		{
		}
示例#6
0
 protected Node(NodeConfig config)
 {
     this.config = config;
 }
示例#7
0
		public Sequence(NodeConfig config): base(config)
		{
		}
示例#8
0
文件: Node.cs 项目: adan830/Egametang
		protected Node(NodeConfig config)
		{
			this.config = config;
		}
        public BehaviorTree CreateTree(NodeConfig config)
        {
            var node = this.CreateTreeNode(config);

            return(new BehaviorTree(node));
        }
示例#10
0
文件: Not.cs 项目: adan830/Egametang
		public Not(NodeConfig config): base(config)
		{
		}