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); }
public Selector(NodeConfig config): base(config) { }
protected Node(NodeConfig config) { this.config = config; }
public Sequence(NodeConfig config): base(config) { }
public BehaviorTree CreateTree(NodeConfig config) { var node = this.CreateTreeNode(config); return(new BehaviorTree(node)); }
public Not(NodeConfig config): base(config) { }