Skip to content

Instantly share code, notes, and snippets.

@adarapata
Created October 1, 2016 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adarapata/f60fe3c835aad328dfdc1b92b82cecbb to your computer and use it in GitHub Desktop.
Save adarapata/f60fe3c835aad328dfdc1b92b82cecbb to your computer and use it in GitHub Desktop.
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