public void It_should_return_failure_if_child_returns_failure() { var child = A.TaskStub().WithUpdateStatus(TaskStatus.Failure).Build(); var selectorRandom = new SelectorRandom(); selectorRandom.AddChild(child); Assert.AreEqual(TaskStatus.Failure, selectorRandom.Update()); }
public void It_should_return_success_if_a_child_returns_success() { var child = A.TaskStub().WithUpdateStatus(TaskStatus.Success).Build(); var selectorRandom = new SelectorRandom(); selectorRandom.AddChild(child); Assert.AreEqual(TaskStatus.Success, selectorRandom.Update()); }
public BTEnemy(Agent ownerBrain) : base(ownerBrain) { rootSelector = new Selector(); charging = new Sequence(); parallelDetection = new Parallel(); //checkInverter = new Inverter(); randomJob = new SelectorRandom(); recharge = new Recharge(GetOwner()); needsCharging = new NeedsCharging(GetOwner()); collectWood = new CollectWood(GetOwner()); collectRocks = new CollectRocks(GetOwner()); collectPower = new CollectPower(GetOwner()); //////////////////////////////// rootSelector.AddChild(charging); rootSelector.AddChild(randomJob); charging.AddChild(needsCharging); charging.AddChild(recharge); randomJob.AddChild(collectWood); randomJob.AddChild(collectRocks); randomJob.AddChild(collectPower); //A parallel to check for the player //checkInverter.AddChild(detection); //Patrol alongside checking for the player //parallelDetection.AddChild(patrolSequence); //patrolSequence.AddChild(patrol); //patrolSequence.AddChild(wait); //patrolSequence.AddChild(turnToPoint); // ////Root -> Adding sequences //rootSelector.AddChild(suspiciousSequence); //rootSelector.AddChild(ChaseSequence); //rootSelector.AddChild(DistractionSequence); // ////Distraction State ////DistractionSequence.AddChild(distraction); //DistractionSequence.AddChild(wait); // ////Suspicious state ////suspiciousSequence.AddChild(suspicious); //suspiciousSequence.AddChild(suspiciousAlert); ////suspiciousSequence.AddChild(moveToLKP); //suspiciousSequence.AddChild(wait); // ////Chase state ////ChaseSequence.AddChild(seen); ////ChaseSequence.AddChild(chase); //ChaseSequence.AddChild(wait); }
public void It_should_return_failure_if_empty() { var selectorRandom = new SelectorRandom(); Assert.AreEqual(TaskStatus.Failure, selectorRandom.Update()); }