Map mehanic ready to multiplayer

This commit is contained in:
2026-08-18 17:17:48 +03:00
parent c01ff800f6
commit bb2f4a3b16
20 changed files with 4691 additions and 1648 deletions
@@ -22,7 +22,7 @@ public sealed class PlayerInteractionController : NetworkBehaviour, IPlayerSyste
private void Update()
{
if (!isInitialized || !IsOwner || Keyboard.current == null)
if (!isInitialized || !IsOwner)
return;
if (PlayerInteractionSessionRegistry.TryGetControlledSession(
@@ -31,7 +31,9 @@ public sealed class PlayerInteractionController : NetworkBehaviour, IPlayerSyste
{
focusedInteractable = null;
if (!Keyboard.current.eKey.isPressed && !activeSessionReleaseRequested)
bool isHoldingControl = Mouse.current != null &&
Mouse.current.leftButton.isPressed;
if (!isHoldingControl && !activeSessionReleaseRequested)
{
activeSessionReleaseRequested = true;
activeSession.RequestRelease();
@@ -44,9 +46,14 @@ public sealed class PlayerInteractionController : NetworkBehaviour, IPlayerSyste
activeSessionReleaseRequested = false;
focusedInteractable = FindFocusedInteractable();
if (Keyboard.current.eKey.wasPressedThisFrame &&
focusedInteractable != null &&
focusedInteractable.IsInteractionAvailable)
if (focusedInteractable == null || !focusedInteractable.IsInteractionAvailable)
return;
bool startsHoldSession = focusedInteractable is IPlayerInteractionSession &&
Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame;
bool performsRegularInteraction = focusedInteractable is not IPlayerInteractionSession &&
Keyboard.current != null && Keyboard.current.eKey.wasPressedThisFrame;
if (startsHoldSession || performsRegularInteraction)
{
focusedInteractable.RequestInteraction();
}
@@ -128,8 +135,11 @@ public sealed class PlayerInteractionController : NetworkBehaviour, IPlayerSyste
if (focusedInteractable == null)
return;
string inputPrompt = focusedInteractable is IPlayerInteractionSession
? "[Hold LMB] "
: "[E] ";
string prompt = focusedInteractable.IsInteractionAvailable
? "[E] " + focusedInteractable.InteractionPrompt
? inputPrompt + focusedInteractable.InteractionPrompt
: "In use";
DrawPrompt(prompt);
}