public IEnumerator Test()
            {
                SimpleAnimation.OnPlayAsObservable("Move").Subscribe(_ => Assert.Pass());
                SimpleAnimation.Play("Move");
                yield return(new WaitForSeconds(2.0f));

                Assert.Fail();
            }
Beispiel #2
0
 public static IObservable <Unit> OnStopAsObservable(this SimpleAnimation self, string stateName = DefaultStateName)
 {
     return(self.OnPlayAsObservable(stateName)
            .SelectMany(
                _ =>
                Observable.EveryUpdate()
                .Select(__ => self[stateName].time)
                .Pairwise()
                .Where(pair => Mathf.Approximately(pair.Previous, pair.Current))
                .Take(1)
                .TakeUntilDestroy(self)
                )
            .AsUnitObservable()
            .Share());
 }