var RotateSpeed=40; //定义旋转速度为整数且为40
var dcount=0; //用于记录当前角度
var dc=0;  //用于辅助记录角度，具体C语言算法读者自己体会

function Update ()
{
	if( upbutton.ubutton && dcount<15 ) //若向上旋转按钮按下且当前角度小于15度，则可以继续向上旋转
	{
		dc=dcount;
		this.transform.Rotate(Vector3.forward*Time.deltaTime*-RotateSpeed); //延Z轴逆时针旋转，即视觉的向上旋转
		dcount = Vector3.Angle(transform.up, Vector3.up); //记录当前值
		if(dcount-dc<0) dcount=-dcount;
	}
	if( downbutton.dbutton && dcount>-15 ) //若向下旋转按钮按下且当前角度大于-15度，则可以继续向下旋转
	{
		dc=dcount;
		this.transform.Rotate(Vector3.forward*Time.deltaTime*RotateSpeed); //延Z轴顺时针旋转，即视觉的向下旋转
		dcount = Vector3.Angle(transform.up, Vector3.up); //记录当前值
		if(dcount-dc>0) dcount=-dcount;
	}
}