feat 客户端

This commit is contained in:
2025-12-17 09:56:43 +08:00
parent d602a16b15
commit 65bd1e5477
30 changed files with 2272 additions and 243 deletions

View File

@@ -1,14 +1,23 @@
using UnityEngine;
// 控制玩家移动
public class PlayerMove : MonoBehaviour
{
public float moveSpeed = 5f; // 移动速度
private Vector3 _targetPosition;
private const float SmoothSpeed = 10f;
private void Start()
{
_targetPosition = transform.position;
}
private void Update()
{
var moveX = Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime;
var moveY = Input.GetAxis("Vertical") * moveSpeed * Time.deltaTime;
transform.position = Vector3.Lerp(transform.position, _targetPosition, SmoothSpeed * Time.deltaTime);
}
transform.Translate(moveX, moveY, 0);
public void SetPosition(float x, float y)
{
_targetPosition = new Vector3(x / 100, y / 100, 0f);
}
}