public SpiderJPTree() { DTBinaryDecision RotatedToSpiderTree = new DTBinaryDecision(RotatedToSpider(), Atack(), Move()); DTBinaryDecision CloseToWebTree = new DTBinaryDecision(CloseToWeb(), Run(), Move()); DTBinaryDecision SpiderEatingTree = new DTBinaryDecision(SpiderEating(), RotatedToSpiderTree, CloseToWebTree); root = new DTBinaryDecision(Eaten(), MoveToSpider(), SpiderEatingTree); }
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(); }