- 最后登录
- 2019-12-2
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 34660
- 纳金币
- 38268
- 精华
- 111
|
- #pragma strict
-
- var old_y:float=0;
- var new_y:float;
- var max_y:float=0;
- var min_y:float=0;
- var d_y:float=0;
- function Update () {
- new_y=Input.acceleration.y;
- d_y=new_y-old_y;
- old_y=new_y;
- if(Input.GetKey(KeyCode.Escape)){
- Application.Quit();
- }
- }
- var i:int;
- function OnGUI(){
- GUI.Label(Rect(100,100,100,100),"g:"+Input.acceleration+"d_y:"+d_y);
- GUI.Label(Rect(100,210,100,100),"i:"+i);
- if(d_y>2){
- i++;
- iPhoneUtils.Vibrate(); //手机的震动效果
- }
复制代码 |
|