16 lines
341 B
C#
16 lines
341 B
C#
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class TestMove : MonoBehaviour
|
||
|
|
{
|
||
|
|
public float speed = 5f;
|
||
|
|
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
float h = Input.GetAxis("Horizontal"); // A / D
|
||
|
|
float v = Input.GetAxis("Vertical"); // W / S
|
||
|
|
|
||
|
|
Vector3 move = new Vector3(h, 0, v);
|
||
|
|
transform.position += move * speed * Time.deltaTime;
|
||
|
|
}
|
||
|
|
}
|