- 最后登录
- 2016-8-29
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 23585
- 纳金币
- 20645
- 精华
- 62
|
根据设备不同选择不同触摸响应对象- 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;
-
- }
复制代码 |
|