UniRx 에셋 추가

This commit is contained in:
Mingu Kim
2025-06-02 00:27:36 +09:00
parent 915f292d7d
commit 8a54d47b56
510 changed files with 42973 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace UniRx.Examples
{
public class Sample08_DetectDoubleClick : MonoBehaviour
{
void Start()
{
// Global event handling is very useful.
// UniRx can handle there events.
// Observable.EveryUpdate/EveryFixedUpdate/EveryEndOfFrame
// Observable.EveryApplicationFocus/EveryApplicationPause
// Observable.OnceApplicationQuit
// This DoubleCLick Sample is from
// The introduction to Reactive Programming you've been missing
// https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
var clickStream = Observable.EveryUpdate()
.Where(_ => Input.GetMouseButtonDown(0));
clickStream.Buffer(clickStream.Throttle(TimeSpan.FromMilliseconds(250)))
.Where(xs => xs.Count >= 2)
.Subscribe(xs => Debug.Log("DoubleClick Detected! Count:" + xs.Count));
}
}
}