public void Update() { if (!_gameManager.enabled && GameHasStarted()) { _spawnPointSpawner.LoadSpawnPoints(); _energySpawner.LoadEnergies(); // If you are the server spawn the visual on the clients if (isServer) { GameObject roundManagerVisual = Instantiate(roundManagerVisualPrefab, Vector3.zero, Quaternion.identity); NetworkServer.Spawn(roundManagerVisual); GameObject rematchScreen = Instantiate(rematchScreenPrefab, Vector3.zero, Quaternion.identity); NetworkServer.Spawn(rematchScreen); } // Find the spawned visual and connect it to the round manager GameObject serverSpawnedRoundManager = GameObject.Find("NetworkRoundManagerVisual(Clone)"); _roundManager.SetVisual(serverSpawnedRoundManager.GetComponent <IRoundManagerVisual>()); GameObject serverSpawnedRematchScreen = GameObject.Find("RematchScreen(Clone)"); serverSpawnedRematchScreen.GetComponent <NetworkRematchScreen>().networkMain = this; _gameManager.StartGame(); _gameManager.enabled = true; } }
public void InializesSpawnPointsProperly() { _baseSpawnPointSpawner.LoadSpawnPoints(); List <SpawnPoint> spawnPoints = _baseSpawnPointSpawner.GetSpawnPoints(); for (int i = 0; i < spawnPoints.Count; i++) { Assert.AreEqual(_fakeSpawnPointLoader.ownerIds[i], spawnPoints[i].GetOwnerId()); Assert.AreEqual(_fakeSpawnPointLoader.siblings[i], spawnPoints[i].GetSibling()); Assert.AreEqual(_fakeSpawnPointLoader.position[i], spawnPoints[i].GetPosition()); } }