private void checkGameReady() { if (ReadyToStart && !Started) { ClockScript.getInstance().stopTimer(); if (PlayerOne == null || PlayerTwo == null) { PlayerOne = PhotonNetwork.PlayerList[0]; PlayerTwo = PhotonNetwork.PlayerList[1]; } if (PhotonNetwork.IsMasterClient) { PhotonNetwork.CurrentRoom.IsOpen = false; ClockScript.getInstance().startTimer(false); SetupSpawn(); SetupTurn(); } RoomName = PhotonNetwork.CurrentRoom.Name; Started = true; GameStatusScript.getInstance().MatchStatus = MatchStatus.INGAME; } else if (!ReadyToStart && !Started) { PlayerWaitTime += Time.deltaTime; if (PlayerWaitTime >= MaxPlayerWaitTime) { ClockScript.getInstance().stopTimer(); PlayerWaitTime = 0; PhotonNetwork.LeaveRoom(); SceneManager.LoadScene(0); } } }
// Update is called once per frame void Update() { if (!TimerStarted) { if (ClockScript.getInstance() != null) { ClockScript.getInstance().startTimer(false); TimerStarted = true; } } }