|
#pragma strict
var MoveSpeed = 20;
var RotateSpeed = 20;
function Start () {
}
function Update () {
if(Input.GetKey(KeyCode.W)||Input.GetKey(KeyCode.UpArrow))
{
transform.Translate(Vector3.forward*Time.deltaTime*MoveSpeed);
}
else if(Input.GetKey(KeyCode.S)||Input.GetKey(KeyCode.DownArrow))
{
transform.Translate(Vector3.forward*Time.deltaTime*-MoveSpeed);
}
else if(Input.GetKey(KeyCode.A)||Input.GetKey(KeyCode.LeftArrow))
{
transform.Translate(Vector3.left*Time.deltaTime*MoveSpeed);
}
else if(Input.GetKey(KeyCode.D)||Input.GetKey(KeyCode.RightArrow))
{
transform.Translate(Vector3.right*Time.deltaTime*MoveSpeed);
}
else if(Input.GetKey(KeyCode.Q)||Input.GetKey(KeyCode.Insert))
{
transform.Rotate(Vector3.up, Time.deltaTime*-RotateSpeed, Space.World);
}
else if(Input.GetKey(KeyCode.E)||Input.GetKey(KeyCode.Home))
{
transform.Rotate(Vector3.up, Time.deltaTime*RotateSpeed, Space.World);
}
else if(Input.GetKey(KeyCode.Z)||Input.GetKey(KeyCode.Delete))
{
transform.Translate(Vector3.up*Time.deltaTime*RotateSpeed);
}
else if(Input.GetKey(KeyCode.C)||Input.GetKey(KeyCode.End))
{
transform.Translate(Vector3.down*Time.deltaTime*RotateSpeed);
}
else if(Input.GetKey(KeyCode.R)||Input.GetKey(KeyCode.PageUp))
{
transform.Rotate(Vector3.left*Time.deltaTime*RotateSpeed);
}
else if(Input.GetKey(KeyCode.F)||Input.GetKey(KeyCode.PageDown))
{
transform.Rotate(Vector3.right*Time.deltaTime*RotateSpeed);
}
else if(Input.GetKey(KeyCode.KeypadPlus))
{
MoveSpeed=MoveSpeed+1;
}
else if(Input.GetKey(KeyCode.KeypadMinus))
{
MoveSpeed=MoveSpeed-1;
}
}
|
|