Skip to content

Commit a62e734

Browse files
committed
Decorators no longer false positive when child is disabled
Fixed a bug where disabled decorator children would cause Enabled to return true
1 parent f429d91 commit a62e734

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Assets/FluidBehaviorTree/Editor/Testing/Decorators/DecoratorTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void Returns_false_if_child_is_disabled () {
3333
var decorator = new DecoratorExample { child = A.TaskStub().Build() };
3434
decorator.child.Enabled.Returns(false);
3535

36-
Assert.IsTrue(decorator.Enabled);
36+
Assert.IsFalse(decorator.Enabled);
3737
}
3838

3939
[Test]

Assets/FluidBehaviorTree/Scripts/TaskParents/Decorators/DecoratorBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public abstract class DecoratorBase : ITask {
66

77
private bool _enabled = true;
88
public bool Enabled {
9-
get { return child != null && _enabled; }
9+
get { return child != null && child.Enabled && _enabled; }
1010
set { _enabled = value; }
1111
}
1212

0 commit comments

Comments
 (0)