Exemple #1
0
 private void OnLevelWasLoaded(int level)
 {
     if (level == GAMEPLAY_SCENE_NUMBER)
     {
         if (!LoadedFromFile)
         {
             // Initialise game normally
             InitialiseGamePlay();
         }
         else
         {
             // Master client loads from the save file and allocate instantiated
             // characters to other clients according to user name
             if (PhotonNetwork.isMasterClient)
             {
                 GameLoader gl   = GameObjectFinder.FindGameLoader();
                 GameSave   save = gl.ReadFile();
                 gl.Load(save);
             }
         }
     }
     if (level == MAINMENU_SCENE_NUMBER)
     {
         Destroy(this.gameObject);
     }
     if (level == RESULT_SCENE_NUMBER)
     {
         PhotonNetwork.Disconnect();
     }
 }