Add test player with FishNet
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using FishNet.Object;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Players
|
||||
{
|
||||
public sealed class PlayerMoving : NetworkBehaviour
|
||||
{
|
||||
[SerializeField] private float _moveSpeed = 5f;
|
||||
[SerializeField] private CharacterController _characterController;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!IsOwner)
|
||||
return;
|
||||
|
||||
float horizontal = Input.GetAxisRaw("Horizontal");
|
||||
float vertical = Input.GetAxisRaw("Vertical");
|
||||
|
||||
Vector3 offset = new Vector3(horizontal, Physics.gravity.y, vertical).normalized * (_moveSpeed * Time.deltaTime);
|
||||
|
||||
_characterController.Move(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user