Skip to content

Instantly share code, notes, and snippets.

@mattak
Created December 21, 2016 12:46
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 mattak/ffaf6a0a11ceaa53cae9a936f305a2c8 to your computer and use it in GitHub Desktop.
Save mattak/ffaf6a0a11ceaa53cae9a936f305a2c8 to your computer and use it in GitHub Desktop.
using UniRx;
using UnityEngine;
namespace App.UI
{
public class GoalSeRenderer : MonoBehaviour
{
public AudioSource AudioSource;
void Start()
{
Unidux.Subject
.TakeUntilDestroy(this)
.Where(state => state.Game.IsStateChanged())
.Where(state => state.Game.Phase == GameEvent.OnGoal)
.Subscribe(_ => PlaySE());
}
void PlaySE()
{
this.AudioSource.PlayOneShot(this.AudioSource.clip);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment