File tree Expand file tree Collapse file tree 2 files changed +8
-14
lines changed
Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ IEnumerator Start()
8181 {
8282 yield return Runner . Tick ( )
8383 . ToObservable ( true )
84- . Subscribe ( xr => Debug . Log ( "Starting Tick on Runner" ) , e => Debug . LogError ( "Error: " + e ) ) . AddTo ( this ) ;
84+ . Subscribe ( xr => { } , e => Debug . LogError ( "Error: " + e ) ) . AddTo ( this ) ;
8585 yield return new WaitForSeconds ( SecondsBetweenTicks ) ;
8686 if ( TimesToTick > 1 ) -- TimesToTick ;
8787 }
Original file line number Diff line number Diff line change @@ -26,23 +26,17 @@ public override IEnumerator Tick(WaitForSeconds delayStart = null)
2626 CurrentState = ( BehaviorState . Running ) ;
2727 foreach ( BehaviorTreeElement behavior in Children )
2828 {
29- yield return behavior . Tick ( ) . ToObservable ( ) . Subscribe ( _ =>
30- {
31-
32- } ) ;
29+ if ( CurrentState != BehaviorState . Running ) yield break ;
3330
34- if ( behavior . CurrentState != BehaviorState . Fail )
31+ yield return behavior . Tick ( ) . ToObservable ( ) . Subscribe ( _ =>
3532 {
36- this . CurrentState = behavior . CurrentState ;
37-
38- if ( this . CurrentState == BehaviorState . Success )
33+ if ( behavior . CurrentState == BehaviorState . Success )
3934 {
40- UnityEngine . Debug . LogError ( "Selector is success" ) ;
41- //This selector has completed, break out of the operation
42- yield break ;
35+ this . CurrentState = behavior . CurrentState ;
36+ return ;
4337 }
44- }
45- Debug . LogError ( "Selector is fail" ) ;
38+ } ) ;
39+
4640 }
4741 //if it gets here, it went through all subbehaviors and had no successes
4842 CurrentState = BehaviorState . Fail ;
You can’t perform that action at this time.
0 commit comments