Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using UnityEngine;
using System.Collections;
using System.Linq;
using Arbor;
using UniRx;
using UniRx.Triggers;
* 指定回数Mouseクリック / Tapがされると次のStateへ遷移するScriptです。
public class ArborTransitionOnClick : StateBehaviour {
[SerializeField][Header("何回Clickしたら次のStateに移るか")] private int _ClickCount;
[SerializeField][Header("Click受付時間")] private double _MultiClickInterval;
[SerializeField] private StateLink _NextState;
void Start () {}
public override void OnStateAwake() {}
public override void OnStateBegin() {
// クリック判定
var clickStream = Observable.EveryUpdate().Where(_ => Input.GetMouseButtonDown(0));
.Select(t => t.Interval.TotalMilliseconds)
.Buffer(_ClickCount, 1)
.Where(list => list[0] > _MultiClickInterval)
.Where(list => list[_ClickCount-1] <= _MultiClickInterval)
.Subscribe(_ => {
Transition( _NextState );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.