赞
踩
#pragma strict
function Start () {
}
var MoveSpeed=5;
var RotateSpeed=20;
function Update () {
if(this.transform.up.y>0 && this.transform.up.y<=10)
if(Input.GetKey(KeyCode.W))
{
print("Moving W");
if(MoveSpeed<=30){
MoveSpeed = MoveSpeed + 10*Time.deltaTime;
}
this.transform.Translate(Vector3.forward*Time.deltaTime*MoveSpeed);
if(Input.GetKey(KeyCode.A))
{
this.transform.Rotate(Vector3.up*Time.deltaTime*-RotateSpeed);
}
else if(Input.GetKey(KeyCode.D))
{
this.transform.Rotate(Vector3.up*Time.deltaTime*RotateSpeed);
}
}
else if(Input.GetKey(KeyCode.S))
{
print("MOving S");
MoveSpeed = 5;
this.transform.Translate(Vector3.forward*Time.deltaTime*-MoveSpeed);
if(Input.GetKey(KeyCode.A))
{
this.transform.Rotate(Vector3.up*Time.deltaTime*-RotateSpeed);
}
else if(Input.GetKey(KeyCode.D))
{
this.transform.Rotate(Vector3.up*Time.deltaTime*RotateSpeed);
}
}
else if(Input.GetKey(KeyCode.A))
{
MoveSpeed = 5;
this.transform.Translate(Vector3.forward*Time.deltaTime*0.1*MoveSpeed);
this.transform.Rotate(Vector3.up*Time.deltaTime*-RotateSpeed);
}
else if(Input.GetKey(KeyCode.D))
{
MoveSpeed = 5;
this.transform.Translate(Vector3.forward*Time.deltaTime*0.1*MoveSpeed);
this.transform.Rotate(Vector3.up*Time.deltaTime*RotateSpeed);
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。