Initial commit

This commit is contained in:
Thorbjoern
2025-05-26 00:46:28 +02:00
commit e5bca03433
3896 changed files with 1434297 additions and 0 deletions
@@ -0,0 +1,26 @@
using UnityEngine;
using Unity.Netcode;
using Unity.XR.CoreUtils;
using UnityEngine.Events;
/// <summary>
/// Simple Network Trigger syncing the events over the network when the local player enters the trigger collider.
/// </summary>
public class NetworkTrigger : NetworkBehaviour
{
[SerializeField, Tooltip("This event is triggered when the Local Player walks into this.")] protected UnityEvent<ulong> m_NetworkedTriggerUnityEvent;
void OnTriggerEnter(Collider other)
{
// Local Player Triggered
if (other.TryGetComponent(out XROrigin origin))
{
TriggerRpc(NetworkManager.Singleton.LocalClientId);
}
}
[Rpc(SendTo.Everyone)]
void TriggerRpc(ulong clientId)
{
m_NetworkedTriggerUnityEvent?.Invoke(clientId);
}
}