1
Misc Archive / logic of Lobby System
« on: February 02, 2018, 04:49:23 AM »
I create channel like this:
after connect to channel create lobbyPlayer by this:
and then everyBody go to game by this(send from tno on localLobbyPlayer):
by LoadLevel - TNet clearUp every network objects(witch we created before - like LobbyPlayer)
but I need this objects after Round again, - I go create it for everyBody after End round, but there I have many problem for sync parameters(just everyBody had this values on network object before - witch destroyed by "TNManager.LoadLevel")
TNManager.LoadLevel - is helpfull for Destroy network GameObjects(like Players) on the scene(because there automaticaly maked DontDestroyable by "TNManager.Instantiate")
it is possible Don't Destroy some network objects on "TNManager.LoadLevel" ?
or my way for making lobbySystem is wrong? what the best logic then?(everyBody go to lobby then start Round and after that back to lobby for nextRound again)
why needed destroy network objects from previous Scene? it is possible work with network object from previous Scene - like lobbyManager with own TNobject for sync parameters?
- TNManager.JoinChannel(Random.Range(10000, 99999), "", false, 8, "", false);
after connect to channel create lobbyPlayer by this:
- TNManager.Instantiate(mChannelID, "CreateLobbyPlayer", "LobbyPlayer", false, TNManager.player.id, TNManager.player.name, myPers);
- [RCC]
- static GameObject CreateLobbyPlayer(GameObject prefab, int id, string pName, int pers)
- {
- GameObject go = prefab.Instantiate();
- LobbyPlayer obj = go.GetComponent<LobbyPlayer>();
- obj.Set(pName, pers);
- if (id == TNManager.player.id)
- {
- localLobbyPlayer = obj;
- }
- return go;
- }
and then everyBody go to game by this(send from tno on localLobbyPlayer):
- TNManager.LoadLevel("GameScene");
by LoadLevel - TNet clearUp every network objects(witch we created before - like LobbyPlayer)
but I need this objects after Round again, - I go create it for everyBody after End round, but there I have many problem for sync parameters(just everyBody had this values on network object before - witch destroyed by "TNManager.LoadLevel")
TNManager.LoadLevel - is helpfull for Destroy network GameObjects(like Players) on the scene(because there automaticaly maked DontDestroyable by "TNManager.Instantiate")
it is possible Don't Destroy some network objects on "TNManager.LoadLevel" ?
or my way for making lobbySystem is wrong? what the best logic then?(everyBody go to lobby then start Round and after that back to lobby for nextRound again)
why needed destroy network objects from previous Scene? it is possible work with network object from previous Scene - like lobbyManager with own TNobject for sync parameters?