IEnumerator RunBehaviour() { BTNode.Result res = Root.Execute(); while (true) // res == BTNode.Result.Running { res = Root.Execute(); yield return(null); } }
private void Update() { if (GetComponent <EnemyController>().CurrentHealth > 0) { _rootNode.Execute(); } }
public override BTNodeStatus Execute() { if (currentNode == null) { currentNode = children[0]; index = 0; } if (currentNode.Execute() == BTNodeStatus.Suceesss) { index++; if (index >= children.Count) { return(BTNodeStatus.Suceesss); } else { currentNode = children[index]; return(BTNodeStatus.Running); } } else { return(BTNodeStatus.Fail); } }
void Update() { root.Execute(this); if (Input.GetKeyDown(KeyCode.Z)) { enemyHealth--; } }
public override BTStatus Execute() => root.Execute();
public void ExecuteBT() { BTRootNode.Execute(); }
public void Run() { root.Execute(); }