Created
April 22, 2015 15:27
-
-
Save TORISOUP/07d21ac470f8ccc4ad1c to your computer and use it in GitHub Desktop.
ボタンの長押しを検知するが最初の数秒は無視する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Start() | |
{ | |
var mouseDown = this.UpdateAsObservable().Where(_ => Input.GetMouseButtonDown(0)); | |
var mouseUp = this.UpdateAsObservable().Where(_ => Input.GetMouseButtonUp(0)); | |
this.UpdateAsObservable() | |
.Where(_ => Input.GetMouseButton(0)) | |
.SkipUntil(mouseDown.Delay(TimeSpan.FromMilliseconds(1000))) | |
.TakeUntil(mouseUp) | |
.Repeat() | |
.Subscribe(_ => Debug.Log("aaa")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment