public void StartTree() { DTAction action = root.MakeDecision(); if (action != null) { action.Run(); } }
void Update() { distanceToPlayer = Vector3.Distance(transform.position, target.position); //Debug.Log("Distance: " + distanceToPlayer); DTBinaryDecision tree = new DTBinaryDecision(() => { return(distanceToPlayer < 50f); }, new DTAction(() => { Attack(); }), new DTAction(() => { Debug.Log("Waiting"); isClose = false; })); new DTBinaryDecision(() => { return(distanceToPlayer < 10f); }, new DTAction(() => { Debug.Log("You died"); }), new DTAction(() => { Debug.Log("Continue"); })); tree.MakeDecision().Run(); }