Created
May 11, 2019 20:28
-
-
Save SocketWeaver/1347d5ef42f44c0500271d3265c077bb to your computer and use it in GitHub Desktop.
GameSceneManager changes to handle the OnReady event of the SceneSpawner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void OnSpawnerReady(bool finishedSceneSetup) | |
{ | |
// scene has not been set up. spawn a car for the local player. | |
if (!finishedSceneSetup) | |
{ | |
// assign different spawn point for the host player and the other players in the room | |
// This is okay for this tutorial as we only have 2 players in a room and we are not handling host migration. | |
// To properly assign spawn points, you should use GameDataManger or custom room data. | |
if (NetworkClient.Instance.IsHost) | |
{ | |
NetworkClient.Instance.LastSpawner.SpawnForPlayer(0, 1); | |
} | |
else | |
{ | |
NetworkClient.Instance.LastSpawner.SpawnForPlayer(0, 0); | |
} | |
// tells the SceneSpawner the local player has finished scene setup. | |
NetworkClient.Instance.LastSpawner.PlayerFinishedSceneSetup(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment