您的位置:首页 > 其它

根据设备不同选择不同触摸响应对象

2013-04-09 16:40 357 查看
function Update () {

var clickDetected : boolean;
var touchPosition : Vector3;

if (Application.platform == RuntimePlatform.IPhonePlayer)
isTouchDevice = true;
else
isTouchDevice = false;

// Detect click and calculate touch position
if (isTouchDevice) {
clickDetected = (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began);
touchPosition = Input.GetTouch(0).position;
} else {
clickDetected = (Input.GetMouseButtonDown(0));
touchPosition = Input.mousePosition;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐