sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class yidong : MonoBehaviour
{
public float myspeed = 0.1f;
void Update()
{
if (Input.GetKey(KeyCode.W))
{
Debug.Log("检测到你按下了w键,我开始移动了");
this.transform.Translate(0, 0, 1 * myspeed, Space.Self);
Debug.Log("开始移动了");
}
if (Input.GetKey(KeyCode.S))
{
Debug.Log("检测到你按下了S键,我开始移动了");
this.transform.Translate(0, 0, -1 * myspeed, Space.Self);
Debug.Log("开始移动了");
}
if (Input.GetKey(KeyCode.A))
{
Debug.Log("检测到你按下了A键,我开始移动了");
this.transform.Translate(-1 * myspeed, 0,0, Space.Self);
Debug.Log("开始移动了");
}
if (Input.GetKey(KeyCode.D))
{
Debug.Log("检测到你按下了D键,我开始移动了");
this.transform.Translate(1 * myspeed, 0, 0, Space.Self);
Debug.Log("开始移动了");
}
}
}