用RepeatButton实现手机屏幕上的点击效果
var controller : CharacterController = GetComponent(CharacterController);
if(GUI.RepeatButton(Rect(65,Screen.height-130,40,40),"W"))
{
controller.SimpleMove(controller.transform.TransformDirection(Vector3.forward)*3);
}
if(GUI.RepeatButton(Rect(25,Screen.height-90,40,40),"A"))
{
controller.transform.Rotate(0,Mathf.Lerp(0,-1,1),0);
// controller.SimpleMove(controller.transform.TransformDirection(controller.transform.Vector3.forward)*3);
// controller.SimpleMove(controller.transform.TransformDirection(Vector3.forward)*-3);
print(Mathf.Lerp(0,-1,1).ToString());
}
if(GUI.RepeatButton(Rect(105,Screen.height-90,40,40),"D"))
{
controller.transform.Rotate(0,1,0);
}
if(GUI.RepeatButton(Rect(65,Screen.height-50,40,40),"S"))
{
controller.SimpleMove(controller.transform.TransformDirection(Vector3.forward)*10);
controller.transform.Rotate(0, Mathf.Lerp(0, 270, 0.01),0);
//carmera_.transform.Rotate(0, Mathf.Lerp(0, 270, 0.01),0);
} 很不错 楼主是超人 好帖就是要顶 顶顶多好 难得一见的好帖 很不错 顶顶多好 真心顶 说的非常好