Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Assets/DefaultNetworkPrefabs.asset

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Prefabs/Objects/SpawnedObjects/NormalDoor.prefab

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 77 additions & 1 deletion Assets/Scenes/GameScene.unity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Assets/Scripts/Core/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ private void Start()
ApplyConfigFromNetwork();
BindConfigListeners();
HUDManager.Instance?.UpdateHUD();

OnLevelStarted?.Invoke();
}

Expand Down
26 changes: 26 additions & 0 deletions Assets/Scripts/Gameplay/Doors/DoorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,31 @@ private bool TryGetHandleEdgeWorldPoint(out Vector3 handleWorld)
return true;
}

private void ShowHUD()
{
string msg = null;

switch (doorType)
{
case DoorType.Normal:
msg = "כל הכבוד! הדלת נפתחה!";
break;

case DoorType.Puzzle:
msg = "כל הכבוד! פתרתם את הפאזל. אפשר להתקדם!";
break;

case DoorType.Exit:
msg = "אלופים! סיימתם את המבוך!";
break;
}

if (!string.IsNullOrEmpty(msg))
{
HudBroadcastNet.Instance.Broadcast(msg);
}
}

// ============================================================
// RPC — OPEN NORMAL/EXIT DOOR
// ============================================================
Expand Down Expand Up @@ -730,6 +755,7 @@ public void RequestOpenDoorServerRpc(Vector3 openerWorldPos)

float chosen = ChooseOpenAngleSign(travellerPos);
OpenDoorRpc(chosen);
ShowHUD();
}

[Rpc(SendTo.Everyone)]
Expand Down
6 changes: 4 additions & 2 deletions Assets/Scripts/Gameplay/Doors/DoorOpenSfx.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Assets/Scripts/Gameplay/Doors/DoorOpenSfx.cs
// Assets/Scripts/Gameplay/Doors/DoorOpenSfx.cs
using System.Collections;
using UnityEngine;

Expand Down Expand Up @@ -77,6 +77,8 @@ private void Update()
_stillFrames = 0;
_source.PlayOneShot(openClip, volume);
}


}

private IEnumerator InitPivotIfNeeded()
Expand Down Expand Up @@ -113,7 +115,7 @@ public void TriggerOpenSfxOnce()
EnsureAudioSource();
_source.PlayOneShot(openClip, volume);

// �� ���� ��� ��-Pivot ����� ����
// àì úðâï ùåá ëù-Pivot éúçéì ìæåæ
_armed = false;
_stillFrames = 0;
_hasLast = false;
Expand Down
4 changes: 3 additions & 1 deletion Assets/Scripts/Gameplay/Player/Traveller/PickupObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ private void RequestPickupServerRpc(ulong pickupNetId, ulong playerNetId, Server
// ✅ IMPORTANT: keys are networked -> add on server (authoritative)
if (gm != null) gm.AddKeys(1);
if (string.IsNullOrWhiteSpace(finalMessage))
finalMessage = "אספת מפתח!";
finalMessage = gm.AllKeysCollected()
? "יש לכם את כל המפתחות! לכו ליציאה."
: "אספת מפתח!";
break;

case PickupType.Lifebuoy:
Expand Down
43 changes: 43 additions & 0 deletions Assets/Scripts/UI/HUD/HudBroadcastNet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Unity.Netcode;
using UnityEngine;

public sealed class HudBroadcastNet : NetworkBehaviour
{
public static HudBroadcastNet Instance { get; private set; }

[Header("Defaults")]
[SerializeField] private float defaultDuration = 1.8f;
[SerializeField] private Color32 defaultColor = new Color32(255, 255, 255, 255);

private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
}

// Call from SERVER only
public void Broadcast(string msg) =>
Broadcast(msg, defaultColor, defaultDuration);

// Call from SERVER only
public void Broadcast(string msg, Color32 color, float duration)
{
if (!IsServer) return;
if (string.IsNullOrWhiteSpace(msg)) return;
ShowForBothClientRpc(msg, color, duration);
}

[ClientRpc]
private void ShowForBothClientRpc(string msg, Color32 color, float duration)
{
var hud = HUDManager.Instance;
if (hud == null) return;

hud.SetMessageAppearanceForBoth((Color)color, duration);
hud.ShowMessageForBoth(msg);
}
}
2 changes: 2 additions & 0 deletions Assets/Scripts/UI/HUD/HudBroadcastNet.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading