【Unity】双击物体

using UnityEngine;
using System.Collections;
using System;
public class Click_yushe : MonoBehaviour {

    DateTime t1,t2;
    int i = 1;


    void OnMouseDown()
    {
        t2 = DateTime.Now;
        if (t2 - t1 < new TimeSpan(0, 0, 0, 0, 500))
        {
            Debug.Log("哎呀竟然双击了好棒~~~~");
                   DestroyImmediate(this.gameObject);
        }
        t1 = t2;
    }
void OnMouseDrag() OnMouseExit()
{

}
}

 

posted @ 2015-09-08 15:38  哎呦不能错喔  阅读(498)  评论(0编辑  收藏  举报