纳金网
标题:
摇晃手机产生震动的效果的脚本
[打印本页]
作者:
狂风大尉
时间:
2014-6-28 01:42
标题:
摇晃手机产生震动的效果的脚本
#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(); //手机的震动效果
}
复制代码
作者:
hyui
时间:
2014-6-28 02:23
Thanks for sharing this !
欢迎光临 纳金网 (http://rs.narkii.com/club/)
Powered by Discuz! X2.5