This commit is contained in:
2025-12-02 18:48:32 +08:00
parent 92ba80b399
commit bf1ca60b3b
2357 changed files with 262694 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
using UnityEngine;
namespace Mirror.Examples.Benchmark
{
public class PlayerMovement : NetworkBehaviour
{
public float speed = 5;
// naming for easier debugging
public override void OnStartClient()
{
name = $"Player[{netId}|{(isLocalPlayer ? "local" : "remote")}]";
}
public override void OnStartServer()
{
name = $"Player[{netId}|server]";
}
void Update()
{
if (!isLocalPlayer) return;
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
Vector3 dir = new Vector3(h, 0, v);
transform.position += dir.normalized * (Time.deltaTime * speed);
}
}
}