private void ProceesTeam(int i_TeamIndex, tnTeamDescription i_TeamDescription) { if (i_TeamDescription == null) { return; } int teamId = i_TeamDescription.teamId; tnTeamData teamData = tnGameData.GetTeamDataMain(teamId); if (teamData == null) { return; } m_TeamsIds.Add(teamId); // Get team size. int teamSize = i_TeamDescription.charactersCount; // Create team results. tnTeamResults teamResults = CreateTeamResults(teamId); m_TeamsResults.Add(teamResults); StateTracker.AddTracking(teamResults); // Callback. OnCreateTeam(i_TeamIndex, i_TeamDescription); for (int characterIndex = 0; characterIndex < teamSize; ++characterIndex) { tnCharacterDescription characterDescription = (PhotonNetwork.offlineMode) ? i_TeamDescription.GetCharacterDescriptionBySpawnOrder(characterIndex) : i_TeamDescription.GetCharacterDescription(characterIndex); if (characterDescription == null) { continue; } int disconnectedPlayerPhotonId = -1; int photonPlayerId; if (PhotonNetwork.offlineMode) { photonPlayerId = 0; // 0 is the default value related to a fake "Local_Player". See TrueSyncController::Initialize. } else { int onlinePlayerIndex = characterDescription.onlinePlayerIndex; tnGameModulesUtils.GetPhotonPlayerOwnerId(onlinePlayerIndex, out photonPlayerId); // Check if the owner of this character is still connected. If not, reset photon player id. PhotonPlayer owner = PhotonUtils.GetPhotonPlayer(photonPlayerId); disconnectedPlayerPhotonId = (owner == null) ? photonPlayerId : -1; photonPlayerId = (owner != null) ? photonPlayerId : -1; } // If photon player id is valid, spawn character. if (photonPlayerId >= 0) { SpawnCharacter(i_TeamIndex, teamSize, characterIndex, photonPlayerId, characterDescription); } else { Debug.LogWarning("[tnMatchController] Character skipped for photon player id " + disconnectedPlayerPhotonId + "."); } } }