using UnityEngine;
using System.Collections;
public class SlideScreen : MonoBehaviour
{
bool one_click = false;
bool timer_running;
float timer_for_double_click;
float delay;
//public Vector3 position;
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (!one_click) // first click no previous clicks
{
one_click = true;
timer_for_double_click = Time.time; // save the current time
// do one click things;
}
else
{
one_click = false; // found a double click, now reset
//do double click things
}
}
if (one_click)
{
// if the time now is delay seconds more than when the first click started.
if ((Time.time - timer_for_double_click) > delay)
{
//basically if thats true its been too long and we want to reset so the next click is simply a single click and not a double click.
one_click = false;
}
}
}
}
Unity 鼠标双击
最新推荐文章于 2025-02-25 11:30:51 发布