void Update()
    {
        if (logger != null)
        {
            logger.UpdateTime(Time.unscaledDeltaTime);
        }

        if (waitForNextFrame)
        {
            _nextFrameTimer += Time.deltaTime;
            if (_nextFrameTimer > NextFrameTimer)
            {
                if (PhotonNetwork.isMasterClient)
                {
                    PhotonNetwork.DestroyAll();
                }
                waitForNextFrame = false;
                StartFrame();
            }
        }

        if (!GameStarted && PhotonNetwork.isMasterClient)
        {
            if (PhotonNetwork.room.playerCount == 2)
            {
                if (!ShowingCountdown)
                {
                    photonView.RPC("ShowCountdown", PhotonTargets.All);
                }

                if (_startTimer > StartTimer)
                {
                    GameStarted = true;
                    // print("RPC call start game");
                    photonView.RPC("StartGame", PhotonTargets.All);

                    Camera.main.GetComponent <MousePan>().Activated = true;
                }
            }
        }
        if (ShowingCountdown)
        {
            _startTimer += Time.deltaTime;
            gui.UpdateCountdownPanel(StartTimer - _startTimer);
        }

        if (opponentDied || iDied || gui.TimeOut())
        {
            waitForEndTimer += Time.deltaTime;
            if (waitForEndTimer > WaitForEndTime)
            {
                // Match is officially over, calculate winner and loser
                CalculateWinner();
            }
        }
    }
    void Update()
    {
        //if (ReadyToStart)
        //{
        //    _startTimer += Time.deltaTime;
        //    if (_startTimer > StartTimer)
        //    {
        //        print("Go!");
        //        ReadyToStart = false;
        //        photonView.RPC("StartGame", PhotonTargets.AllBuffered);
        //    }
        //}

        if (!GameStarted && PhotonNetwork.isMasterClient)
        {
            if (PhotonNetwork.room.playerCount == 2)
            {
                if (!ShowingCountdown)
                {
                    photonView.RPC("ShowCountdown", PhotonTargets.All);
                }

                if (_startTimer > StartTimer)
                {
                    print("RPC call start game");
                    photonView.RPC("StartGame", PhotonTargets.All);
                    GameStarted = true;
                }
            }
        }
        if (ShowingCountdown)
        {
            _startTimer += Time.deltaTime;
            gui.UpdateCountdownPanel(StartTimer - _startTimer);
        }
    }