Пример #1
0
    void ProblemSelect()
    {
        int suvivePlayerCount = objController.GetSuvivePlayerCount();

        pv.RPC("RPC_SuvivePannel", RpcTarget.All, suvivePlayerCount);
        if (suvivePlayerCount < 2)
        {
            if (PhotonNetwork.IsMasterClient)
            {
                PhotonNetwork.CurrentRoom.IsOpen = true;
            }
            GameOver();
            return;
        }

        timer = 30f;
        while (ListProblem.Count < Round)
        {
            quizNum = UnityEngine.Random.Range(0, quiz.GetProblemCount());
            if (!ListProblem.Contains(quizNum))
            {
                //제출 하지 문제 선정
                ListProblem.Add(quizNum);
                break;
            }
        }

        string problem = "문제 : " + quiz.GetProblem(quizNum);

        pv.RPC("RPC_ProblemPannel", RpcTarget.All, problem);

        StartCoroutine(CountStart(quizNum));
    }
Пример #2
0
    IEnumerator ProblemStart(float limitCount)
    {
        if (ListProblem.Count == Round)// || ListViewer.Count ==1)
        {
            Debug.Log("Game Over");
            yield break;
        }

        //문제 찾기
        int rndQuiz = 0;

        while (ListProblem.Count < Round)
        {
            rndQuiz = Random.Range(0, quiz.GetProblemCount());
            if (!ListProblem.Contains(rndQuiz))
            {
                //제출 하지 문제 선정
                ListProblem.Add(rndQuiz);
                break;
            }
        }

        //문제 제출시 이동 입력 허용
        UiPannel.GetComponent <TwitchPannel>().SetInfo("문제 : " + quiz.GetProblem(rndQuiz));
        twitchStream.isInputPossible = true;

        UiPannel.GetComponent <TwitchPannel>().txtInputInfo.gameObject.SetActive(true);

        while (!UiPannel.GetComponent <TwitchPannel>().isProblemTimeComplete)
        {
            yield return(null);
        }

        //카운트
        while (limitCount > 0)
        {
            limitCount -= Time.deltaTime;
            yield return(null);

            UiPannel.GetComponent <TwitchPannel>().SetCount(Convert.ToInt32(limitCount));
        }

        UiPannel.GetComponent <TwitchPannel>().txtInputInfo.gameObject.SetActive(false);
        //정답 발표 이동 입력 방지
        twitchStream.isInputPossible = false;
        bool   isTrue = quiz.GetAnswer(rndQuiz);
        string OX     = isTrue ? "O" : "X";

        UiPannel.GetComponent <TwitchPannel>().SetInfo("정답은 : " + OX);

        yield return(new WaitForSeconds(5.0f));

        //정답 발표 후 탈락저 처리


        MiddleObj.SetActive(false);
        if (isTrue)
        {
            XObj.SetActive(false);
        }
        else
        {
            OObj.SetActive(false);
        }


        yield return(new WaitForSeconds(5.0f));

        MiddleObj.SetActive(true);
        XObj.SetActive(true);
        OObj.SetActive(true);

        yield return(new WaitForSeconds(3.0f));

        //코르틴 재호출
        StartCoroutine(ProblemStart(15));
    }