-
Notifications
You must be signed in to change notification settings - Fork 117
Observable Examples
rpgwhitelock edited this page Jan 8, 2015
·
11 revisions
Inspired by http://rxwiki.wikidot.com/101samples
Once per second, execute command to damage player
Observable.Interval(TimeSpan.FromMilliseconds(1000))
.Subscribe(_ => {
ExecutedamagePerSecondTick();
}).DisposeWhenChanged(Player.healthStateProperty);
uGUI events as observables. A button as an event stream in your view.
Button poorButton; // Our button.
poorButton.AsClickObservable()
.Where(_ => YOUR FILTER )
.Throttle(_ => PREVENT SPAMMING )
.DelayFrame( FRAMES TO DELAY )
.SkipWhile( SKIP FIRST TAPS IF CONDITION IS NOT MET )
.Subscribe(_ =>
{
USE LIKE SIMPLE OBSERVABLE
});