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
@@ -1,3 +1,4 @@
using System;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
@@ -52,7 +53,10 @@ public sealed class NetworkPhysicalLeverInteractable :
public bool IsControlled => controllingClientId.Value != NoController;
public bool IsControlledByLocalPlayer =>
NetworkManager != null && IsControlledBy(NetworkManager.LocalClientId);
public string ReleasePrompt => "[Hold E] Pulling lever";
public string ReleasePrompt => "[Hold LMB] Pulling lever";
public event Action<float> ValueChanged;
public event Action<bool> StateChanged;
public override string InteractionPrompt => IsControlledByLocalPlayer
? ReleasePrompt
@@ -304,11 +308,15 @@ public sealed class NetworkPhysicalLeverInteractable :
private void HandleValueChanged(float _, float currentValue)
{
ApplyVisual(currentValue);
ValueChanged?.Invoke(currentValue);
leverValueChanged?.Invoke(currentValue);
}
private void HandleActivationChanged(bool _, bool currentState) =>
private void HandleActivationChanged(bool _, bool currentState)
{
StateChanged?.Invoke(currentState);
leverStateChanged?.Invoke(currentState);
}
private void ApplyVisual(float value)
{