Example #1
0
    IEnumerator StartCountdown()
    {
        timeText.text = "Game Starts in";

        yield return(new WaitForSeconds(2f));

        if (!isLoadingScene)
        {
            if (customs)
            {
                if (PhotonNetwork.player.IsMasterClient)
                {
                    CustomeValue = new ExitGames.Client.Photon.Hashtable();
                    startTime    = PhotonNetwork.time;
                    CustomeValue.Add("StartTime", startTime);
                    PhotonNetwork.room.SetCustomProperties(CustomeValue);
                }
                else
                {
                    startTime = double.Parse(PhotonNetwork.room.CustomProperties["StartTime"].ToString());
                }
                customs = false;
            }

            timerIncrementValue = PhotonNetwork.time - startTime;
            double getfrom = timer - timerIncrementValue;
            timeText.text = string.Format("{0:0}", getfrom);

            if (getfrom < 1)
            {
                timeText.text = "GO!";
            }

            if (timerIncrementValue >= timer)
            {
                StartCoroutine(SetTestToBlank());
                loadingSceneMg.LoadScreen("TestGame");
                isLoadingScene = true;
                //PhotonNetwork.LoadLevel("TestGame");
            }
        }
    }