纳金网
标题:
根据设备不同选择不同触摸响应对象
[打印本页]
作者:
王者再临
时间:
2015-2-26 15:36
标题:
根据设备不同选择不同触摸响应对象
根据设备不同选择不同触摸响应对象
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;
}
复制代码
欢迎光临 纳金网 (http://rs.narkii.com/club/)
Powered by Discuz! X2.5