public bool InitTreeByJsonData(JsonData jsonData) { rootNode = null; rootNode = new BNodeRoot(); JsonData tree = jsonData["tree"]; rootNode.NodeName = (string)tree["name"]; //Debug.LogError("rootNode.NodeName " + rootNode.NodeName); for (int i = 0; i < tree["children"].Count; i++) { JsonData nodeJson = tree["children"][i]; AddChildNode(nodeJson, rootNode); } return(true); }
public BTree() { rootNode = new BNodeRoot(); #region test //BNodeSequence nodeSequence1 = new BNodeSequence(); //nodeSequence1.AddChild(new ConditionNothing()); //nodeSequence1.AddChild(new ActionNodeNothing()); //BNodeSequence nodeSequence2 = new BNodeSequence(); //nodeSequence2.AddChild(new ConditionNothing()); //nodeSequence2.AddChild(new DecoratorNothing()); //BNodeSelector nodeSelector = new BNodeSelector(); //nodeSelector.AddChild(nodeSequence1); //nodeSelector.AddChild(nodeSequence2); //rootNode.AddChild(nodeSelector); //return; #endregion }