赞
踩
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
using UnityEngine;
using System.Collections;
public class Tank : MonoBehaviour {
//float MoveSpeed=10f;
//float RotateSpeed = 10f;
// Use this for initialization
void Start () {
}
public float MoveSpeed = 10f;
public float RotateSpeed = 10f;
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.W) || Input.GetAxis(KeyCode.Up) ) {
//print("W");
transform.Translate(Vector3.up*Time.deltaTime * -MoveSpeed);
}
if (Input.GetKey(KeyCode.S))
{
//print("S");
transform.Translate(Vector3.up * Time.deltaTime * MoveSpeed);
}
if (Input.GetKey(KeyCode.A))
{
//print("A");
transform.Rotate(Vector3.forward * Time.deltaTime * -RotateSpeed);
}
if (Input.GetKey(KeyCode.D))
{
//print("D");
transform.Rotate(Vector3.forward * Time.deltaTime * RotateSpeed);
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。