Started make greybox for main location

This commit is contained in:
2026-08-05 17:49:42 +03:00
parent a259a64e80
commit 90934eca22
648 changed files with 314989 additions and 578 deletions
@@ -0,0 +1,42 @@
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
[RequireComponent(typeof(PlayerController), typeof(FirstPersonCameraController))]
public sealed class PlayerInputController : NetworkBehaviour, IPlayerSystem
{
[SerializeField, Min(0.001f)] private float mouseSensitivity = 0.08f;
private PlayerController playerController;
private FirstPersonCameraController cameraController;
private bool isInitialized;
public void Initialize(PlayerFacade facade)
{
playerController = GetComponent<PlayerController>();
cameraController = GetComponent<FirstPersonCameraController>();
isInitialized = playerController != null && cameraController != null;
}
private void Update()
{
if (!isInitialized || !IsOwner || Keyboard.current == null)
return;
Vector2 moveInput = new(
(Keyboard.current.dKey.isPressed ? 1f : 0f) - (Keyboard.current.aKey.isPressed ? 1f : 0f),
(Keyboard.current.wKey.isPressed ? 1f : 0f) - (Keyboard.current.sKey.isPressed ? 1f : 0f));
playerController.SubmitMovement(
moveInput,
Keyboard.current.leftShiftKey.isPressed,
Keyboard.current.spaceKey.wasPressedThisFrame);
if (Mouse.current == null)
return;
Vector2 mouseDelta = Mouse.current.delta.ReadValue() * mouseSensitivity;
playerController.SubmitYaw(mouseDelta.x);
cameraController.ApplyPitch(mouseDelta.y);
}
}