File tree Expand file tree Collapse file tree 3 files changed +17
-12
lines changed
Assets/FluidBehaviorTree/Scripts/TaskParents/Composites Expand file tree Collapse file tree 3 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -28,5 +28,20 @@ public override void Reset (bool hardReset = false) {
2828
2929 base . Reset ( hardReset ) ;
3030 }
31+
32+ protected bool AbortSelf ( TaskStatus requiredStatus ) {
33+ if ( ! AbortType . HasFlag ( AbortType . Self )
34+ || ChildIndex <= 0
35+ || SelfAbortTask == null
36+ || SelfAbortTask . Update ( ) != requiredStatus ) {
37+ return false ;
38+ }
39+
40+ children [ ChildIndex ] . End ( ) ;
41+ Reset ( ) ;
42+
43+ return true ;
44+
45+ }
3146 }
3247}
Original file line number Diff line number Diff line change 33namespace Adnc . FluidBT . TaskParents {
44 public class Selector : CompositeBase {
55 protected override TaskStatus OnUpdate ( ) {
6- if ( AbortType . HasFlag ( AbortType . Self )
7- && ChildIndex > 0
8- && SelfAbortTask != null
9- && SelfAbortTask . Update ( ) == TaskStatus . Success ) {
10- children [ ChildIndex ] . End ( ) ;
11- Reset ( ) ;
6+ if ( AbortSelf ( TaskStatus . Success ) ) {
127 return Update ( ) ;
138 }
149
Original file line number Diff line number Diff line change 33namespace Adnc . FluidBT . TaskParents {
44 public class Sequence : CompositeBase {
55 protected override TaskStatus OnUpdate ( ) {
6- if ( AbortType . HasFlag ( AbortType . Self )
7- && ChildIndex > 0
8- && SelfAbortTask != null
9- && SelfAbortTask . Update ( ) == TaskStatus . Failure ) {
10- children [ ChildIndex ] . End ( ) ;
11- Reset ( ) ;
6+ if ( AbortSelf ( TaskStatus . Failure ) ) {
127 return TaskStatus . Failure ;
138 }
149
You can’t perform that action at this time.
0 commit comments