public void SyncLevelSettings(string lvlName, bool teams, bool bots, float roundTime) { if (levelSettings == null) { if (!(GameObject.Find("LevelSettings"))) { levelSettings = new GameObject(); levelSettings.AddComponent <LevelSettings>(); } else { levelSettings = GameObject.Find("LevelSettings"); } } LevelSettings config = levelSettings.GetComponent <LevelSettings>(); config.LevelName = lvlName; config.HasTeams = teams; config.Bots = bots; config.RoundTime = roundTime; config.LoadLevel(); levelConfig = config; levelSynced = true; }
public static bool lockControls = false; // свойство для блокировки управления персонажем // bool public void Awake() { LoadScreen.gameObject.SetActive(true); //Пока все не загрузилось, кажем загрузочный экран photonView = GetComponent <PhotonView>(); if (!PhotonNetwork.connected) { Application.LoadLevel(Lobby.SceneNameMenu); return; } // player = PhotonNetwork.Instantiate(this.PlayerPrefab.name, transform.position, Quaternion.identity, 0) as GameObject; if (PhotonNetwork.isMasterClient) // Если мы сервер, запускаем процедуру инициализации уровня { if (levelSettings == null) { levelSettings = GameObject.Find("LevelSettings"); } LevelSettings s = levelSettings.GetComponent <LevelSettings>(); levelConfig = s; // photonView.RPC("SyncLevelSettings", PhotonTargets.OthersBuffered, s.LevelName, s.HasTeams, s.Bots, s.RoundTime); s.LoadLevel(); levelSynced = true; } }