Author Topic: logic of Lobby System  (Read 1277 times)

Elmo loves cookies

  • Jr. Member
  • **
  • Thank You
  • -Given: 60
  • -Receive: 1
  • Posts: 62
    • View Profile
logic of Lobby System
« on: February 02, 2018, 04:49:23 AM »
I create channel like this:

  1. TNManager.JoinChannel(Random.Range(10000, 99999), "", false, 8, "", false);

after connect to channel create lobbyPlayer by this:

  1. TNManager.Instantiate(mChannelID, "CreateLobbyPlayer", "LobbyPlayer", false, TNManager.player.id, TNManager.player.name, myPers);
  2.  
  3. [RCC]
  4.     static GameObject CreateLobbyPlayer(GameObject prefab, int id, string pName, int pers)
  5.     {
  6.         GameObject go = prefab.Instantiate();
  7.         LobbyPlayer obj = go.GetComponent<LobbyPlayer>();
  8.         obj.Set(pName, pers);
  9.         if (id == TNManager.player.id)
  10.         {
  11.             localLobbyPlayer = obj;
  12.         }
  13.         return go;
  14.     }
  15.  

and then everyBody go to game by this(send from tno on localLobbyPlayer):

  1. TNManager.LoadLevel("GameScene");
  2.  

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?
« Last Edit: February 03, 2018, 11:08:45 PM by Elmo »