unity鼠标双击的获取
/**Unity联盟
by-Robin
*/
public class test : MonoBehaviour
{
//这就是控制你两次点击鼠标间隔的时间
public float doubeClickDelay = 0.4f;
bool firstClick = false;
bool secondClick = false;
float firstClickTime;
float secondClickTime;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Time.time - firstClickTime > doubeClickDelay)
{
firstClick = false;
secondClick = false;
}
}
void OnMouseUp()
{
print("up!!");
if (firstClick == false)
{
firstClick = true;
firstClickTime = Time.time;
return;
}
if (firstClick)
{
secondClick = true;
secondClickTime = Time.time;
print("Unity联盟");
}
}
}
不错 不错 不错{:soso__3922851084632044791_6:} 很不错 楼主是超人 顶顶多好 难得一见的好帖 LZ真是人才 难得一见的好帖 说的非常好 很好哦
页:
[1]