14 lines
352 B
C#
14 lines
352 B
C#
using UnityEngine;
|
|
|
|
public class PlayerMove : MonoBehaviour
|
|
{
|
|
public float moveSpeed = 5f; // 移动速度
|
|
|
|
private void Update()
|
|
{
|
|
var moveX = Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime;
|
|
var moveY = Input.GetAxis("Vertical") * moveSpeed * Time.deltaTime;
|
|
|
|
transform.Translate(moveX, moveY, 0);
|
|
}
|
|
} |