Skip to content

Instantly share code, notes, and snippets.

@kyubuns
Created February 19, 2018 13:07
Show Gist options
  • Select an option

  • Save kyubuns/5c0a5810cd4181e64dcb083a5068d3de to your computer and use it in GitHub Desktop.

Select an option

Save kyubuns/5c0a5810cd4181e64dcb083a5068d3de to your computer and use it in GitHub Desktop.
public class BarAnimation : MonoBehaviour
{
[SerializeField] private SpriteRenderer sprite;
private readonly Subject<Unit> subject = new Subject<Unit>();
public void Start()
{
subject.Select(_ => Anime.Play(new Vector3(1.5f, 1.5f, 1.5f), new Vector3(1f, 1f, 1f), Easing.OutElastic(TimeSpan.FromSeconds(0.5f))))
.Switch()
.SubscribeToLocalScale(sprite.transform)
.AddTo(this);
}
public void OnHitBall(Ball ball)
{
subject.OnNext(Unit.Default);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment