public void RestartGame(bool masterclientSwitched, bool restartManually) { if (gameTimesUp || logic.Restarting) { return; } GameModes.OnRestart(); checkpoint = null; logic.Restarting = true; logic.RoundTime = 0f; logic.MyRespawnTime = 0f; foreach (var info in killInfoList) { info.destroy(); } killInfoList.Clear(); racingResult = new ArrayList(); RCManager.ClearVariables(); ShowHUDInfoCenter(string.Empty); DestroyAllExistingCloths(); GameModes.SendRpc(); PhotonNetwork.DestroyAll(); BasePV.RPC("RPCLoadLevel", PhotonTargets.All); if (masterclientSwitched) { SendChatContentInfo(User.MasterClientSwitch); } else { if (!restartManually && User.MsgRestart.Length > 0) { SendChatContentInfo(User.MsgRestart); } } }
public void OnJoinedRoom(AOTEventArgs args) { Debug.Log("OnJoinedRoom >> " + PhotonNetwork.room.Name); var strArray = PhotonNetwork.room.Name.Split('`'); gameTimesUp = false; Level = LevelInfo.GetInfo(strArray[1]); switch (strArray[2].ToLower()) { case "normal": difficulty = 0; break; case "hard": difficulty = 1; break; case "abnormal": difficulty = 2; break; default: difficulty = 1; break; } IN_GAME_MAIN_CAMERA.Difficulty = difficulty; time = int.Parse(strArray[3]) * 60; logic.ServerTimeBase = time; logic.ServerTime = time; switch (strArray[4].ToLower()) { case "day": case "день": IN_GAME_MAIN_CAMERA.DayLight = DayLight.Day; break; case "dawn": case "вечер": IN_GAME_MAIN_CAMERA.DayLight = DayLight.Dawn; break; case "night": case "ночь": IN_GAME_MAIN_CAMERA.DayLight = DayLight.Night; break; default: IN_GAME_MAIN_CAMERA.DayLight = DayLight.Dawn; break; } IN_GAME_MAIN_CAMERA.GameMode = Level.Mode; PhotonNetwork.LoadLevel(Level.MapName); if (PhotonNetwork.IsMasterClient) { GameModes.Load(); GameModes.ForceChange(); GameModes.SendRpc(); } var player = PhotonNetwork.player; player.RCIgnored = false; player.UIName = User.Name; player.GuildName = User.AllGuildNames; player.Kills = player.Deaths = player.MaximumDamage = player.TotalDamage = 0; player.RCteam = 0; player.Dead = true; player.IsTitan = false; localRacingResult = string.Empty; needChooseSide = true; foreach (var info in killInfoList) { info.destroy(); } killInfoList.Clear(); RCManager.racingSpawnPointSet = false; if (!PhotonNetwork.IsMasterClient) { BasePV.RPC("RequireStatus", PhotonTargets.MasterClient); } foreach (var her in heroes) { if (her.BasePV != null && her.BasePV.owner.GameObject == null) { her.BasePV.owner.GameObject = her.baseG; } } PhotonNetwork.SetModProperties(); }