Files
jelito/Assets/jelycho/Code/Main/GameWorldController.cs
2025-07-01 18:57:49 +02:00

35 lines
977 B
C#

using System;
using RebootKit.Engine.Main;
using RebootReality.jelycho.Beacons;
using Unity.Netcode;
using UnityEngine;
using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootReality.jelycho.Main {
public class GameWorldController : NetworkWorldController {
static readonly Logger s_Logger = new Logger(nameof(GameWorldController));
public static GameWorldController Instance { get; private set; }
[SerializeField] BaseManager m_BaseManager;
void Awake() {
Instance = this;
}
public override void OnDestroy() {
Instance = null;
base.OnDestroy();
}
[Rpc(SendTo.Server)]
public void RequestBeaconSpawnRpc(Vector3 position) {
if (!IsServer) {
s_Logger.Error("Only the server can spawn beacons.");
return;
}
m_BaseManager.SpawnBeaconServerRpc(position);
}
}
}