Added game state and network client

This commit is contained in:
2026-05-20 19:56:25 +01:00
parent 8d3998945a
commit 48f8ae6c08
34 changed files with 713 additions and 16 deletions

View File

@@ -0,0 +1,33 @@
using Unity.Netcode;
using UnityEngine;
namespace PashaBibko.PenguinChase.GameState
{
public class GameStateSpawner : MonoBehaviour
{
private static GameStateSpawner sInstance;
[Header("References")]
[SerializeField] private GameObject GameStateControllerPrefab;
private void Awake()
{
// Stops overlapping instances
if (sInstance is not null)
{
Debug.LogError($"Multiple of [{nameof(GameStateSpawner)}] cannot exist.");
Destroy(gameObject);
return;
}
sInstance = this;
}
public static void CreateNetworkGameStateController()
{
GameObject go = Instantiate(sInstance.GameStateControllerPrefab);
go.GetComponent<NetworkObject>().Spawn();
DontDestroyOnLoad(go);
}
}
}