mmorpg/Assets/Mirror/Examples/Benchmark/Scripts/PlayerMovement.cs
2024-08-23 16:17:24 +05:30

21 lines
468 B
C#
Executable File

using UnityEngine;
namespace Mirror.Examples.Benchmark
{
public class PlayerMovement : NetworkBehaviour
{
public float speed = 5;
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);
}
}
}