Add test player with FishNet

This commit is contained in:
Nikita Dugin
2026-04-07 17:33:44 +03:00
parent 11ab636608
commit 0e3b3a1ccf
8 changed files with 442 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 35bd5ef7798f2cf429ce5b8a8fe07d0a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+25
View File
@@ -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);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5c6622ebbd074d37a0d6e873d1ce5fb5
timeCreated: 1775564440