纳金网
标题: 用RepeatButton实现手机屏幕上的点击效果 [打印本页]
作者: may 时间: 2015-11-20 04:13
标题: 用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);
}
欢迎光临 纳金网 (http://rs.narkii.com/club/) |
Powered by Discuz! X2.5 |