> > > > > > > > > >
判斷x軸,並分類顯示速度
function Update () {
var xValue = Input.acceleration.x;
var Speed;
if(xValue >= 0.4)
Speed = "最慢";
else if(0.4>xValue && xValue >= 0.1)
Speed = "慢";
else if(0.1>xValue && xValue >= -0.1)
Speed = "正常";
else if(-0.1>xValue && xValue >= -0.2)
Speed = "快";
if(xValue < -0.2)
Speed = "最快";
guiText.text = Speed;
}
沒有留言:
張貼留言