private float tapThreshold = 0.25f;
private float tapTimer = 0.0f;
private bool tap = false;
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (Time.time < this.tapTimer + this.tapThreshold)
{
Debug.Log("双击");
this.tap = false;
return;
}
this.tap = true;
this.tapTimer = Time.time;
}
if (this.tap == true && Time.time > this.tapTimer + this.tapThreshold)
{
this.tap = false;
Debug.Log("单击");
}
}