void Start() { /* First, the AI checks its own health. If it's low, it will want to heal */ healthCheckNode = new ActionNode(CriticalHealthCheck); /* Next, the AI will check the player's heatlth. If it's low, it will always * go for the kill */ attackCheckNode = new ActionNode(CheckPlayerHealth); /* If neither the player nor the AI are low in health, the AI will * prioritize using a defensive buff. To avoid having the AI buff every turn, * we use a binary randomizer to only do it half the time. */ buffCheckRandomNode = new RandomBinaryNode(); buffCheckNode = new ActionNode(BuffCheck); buffCheckSequence = new Sequence(new List <Node> { buffCheckRandomNode, buffCheckNode, }); rootNode = new Selector(new List <Node> { healthCheckNode, attackCheckNode, buffCheckSequence, }); }
// Use this for initialization void Start() { healthCheckNode = new ActionNode(CriticalHealthCheck); attackCheckNode = new ActionNode(CheckPlayerHealth); buffCheckRandomNode = new RandomBinaryNode(); buffCheckNode = new ActionNode(BuffCheck); buffCheckSequence = new Sequence(new List <BTNode> { buffCheckRandomNode, buffCheckNode, }); rootNode = new Selector(new List <BTNode> { healthCheckNode, attackCheckNode, buffCheckSequence, }); }