Created
October 1, 2016 05:01
-
-
Save adarapata/f60fe3c835aad328dfdc1b92b82cecbb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Arbor; | |
using UniRx; | |
[BuiltInBehaviour] | |
public class ObserveTransition : StateBehaviour | |
{ | |
public StateBehaviour target; | |
public string methodName = ""; | |
public StateLink next; | |
public override void OnStateBegin() | |
{ | |
IObservable<Unit> obs = target.GetType().GetMethod(methodName).Invoke(target, null) as IObservable<Unit>; | |
obs.Take(1).Subscribe(__ => Transition(next)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment