Skip to content

Commit 36b4208

Browse files
committed
Trees can now be manually reset
1 parent 8aee8a4 commit 36b4208

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Assets/FluidBehaviorTree/Scripts/BehaviorTree/Editor/TreeTest.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using Adnc.FluidBT.TaskParents.Composites;
1+
using System.Collections.Generic;
2+
using Adnc.FluidBT.TaskParents;
3+
using Adnc.FluidBT.TaskParents.Composites;
24
using Adnc.FluidBT.Tasks;
35
using NSubstitute;
46
using NUnit.Framework;
@@ -49,6 +51,15 @@ public void Set_the_child_nodes_GameObject_reference () {
4951
}
5052
}
5153

54+
public class ResetMethod : TreeTest {
55+
[Test]
56+
public void It_should_increase_the_tick_count () {
57+
_tree.Reset();
58+
59+
Assert.AreEqual(1, _tree.TickCount);
60+
}
61+
}
62+
5263
public class TickMethod : TreeTest {
5364
private ITask _action;
5465

Assets/FluidBehaviorTree/Scripts/BehaviorTree/Tree.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ public Tree (GameObject owner) {
1616
Root.Owner = owner;
1717
}
1818

19+
public void Reset () {
20+
TickCount++;
21+
}
22+
1923
public void AddNode (ITaskParent parent, ITask child) {
2024
parent.AddChild(child);
2125
child.ParentTree = this;

0 commit comments

Comments
 (0)