Files
ichni_Creator_Studio/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs
SoulliesOfficial 8d0abec75f 基础内容
必要插件安装
缓动曲线和动画基础
ElementFolder,Track与其次级模块,PathNode重构
2025-01-26 21:10:16 -05:00

23 lines
761 B
C#

#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)
using UnityEngine;
using UniRx.Triggers; // for enable gameObject.EventAsObservbale()
namespace UniRx.Examples
{
public class Sample03_GameObjectAsObservable : MonoBehaviour
{
void Start()
{
// All events can subscribe by ***AsObservable if enables UniRx.Triggers
this.OnMouseDownAsObservable()
.SelectMany(_ => this.gameObject.UpdateAsObservable())
.TakeUntil(this.gameObject.OnMouseUpAsObservable())
.Select(_ => Input.mousePosition)
.RepeatUntilDestroy(this)
.Subscribe(x => Debug.Log(x), ()=> Debug.Log("!!!" + "complete"));
}
}
}
#endif