Map mehanic ready to multiplayer
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user