public void OnHitBall(Ball ball) { Messenger.Broker.Publish(new OnRefrectBall()); ball.IsAlive = false; subject.OnNext(Unit.Default); var spriteRenderer = ball.GetComponent <SpriteRenderer>(); spriteRenderer.color = spriteRenderer.color / 1.5f; spriteRenderer.sortingLayerID = SortingLayer.NameToID("ReflectedBall"); var s = ball.transform.localScale; s.y /= 2f; ball.transform.localScale = s; Observable.Timer(anime1) .TakeUntilDestroy(ball.gameObject) .Subscribe(_ => { Anime.PlayRelative(ball.transform.position, new Vector3(0f, 30f, 0f), Easing.OutExpo(TimeSpan.FromSeconds(3f))) .TakeUntilDestroy(ball.gameObject) .DoOnCompleted(() => Destroy(ball.gameObject)) .SubscribeToPosition(ball.transform); Anime.PlayRelative(ball.transform.localScale, new Vector3(-0.3f, 10f, 0f), Easing.OutExpo(TimeSpan.FromSeconds(0.5f))) .TakeUntilDestroy(ball.gameObject) .SubscribeToLocalScale(ball.transform); }).AddTo(ball); }
private void Sample14() { Anime.PlayRelative(new Vector3(-5f, 0.75f, 0f), new Vector3(5f, 0f, 0f), Easing.InCubic(Velocity.FromPerSecond(2f))) .PlayRelative(new Vector3(5f, 0f, 0f), Easing.OutCubic(Velocity.FromPerSecond(2f))) .SubscribeToPosition(cube); Anime.PlayRelative(new Vector3(-5f, -0.75f, 0f), new Vector3(5f, 0f, 0f), Easing.InCubic(Velocity.FromPerSecond(2f))) .PlayRelative(new Vector3(5f, 0f, 0f), Easing.OutCubic(Velocity.FromPerSecond(2f))) .SubscribeToPosition(cube2); }
private void Sample16() { Anime.PlayRelative(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), Easing.Linear(TimeSpan.FromSeconds(1f))) .PlayRelative(new Vector3(5f, 0f, 0f), Easing.Linear(TimeSpan.FromSeconds(1f))) .Do(x => Debug.LogFormat("cube1 {0} {1}", Time.time, x.x)) .SubscribeToPosition(cube); Anime.PlayRelative(new Vector3(-5f, -1f, 0f), new Vector3(5f, 0f, 0f), Easing.Linear(TimeSpan.FromSeconds(1f))) .PlayRelative(new Vector3(5f, 0f, 0f), Easing.Linear(TimeSpan.FromSeconds(1f))) .Do(x => Debug.LogFormat("cube2 {0} {1}", Time.time, x.x)) .SubscribeToPosition(cube2); Observable.Interval(TimeSpan.FromSeconds(5f)) .Subscribe(_ => Sample16()); }