Ejemplo n.º 1
0
    public void SetController(OpenDoorRound controller)
    {
        _controller = controller;

        for (int i = 0; i < _answerButtons.Length; i++)
        {
            int index = i;
            _answerButtons[i].onClick.RemoveAllListeners();
            _answerButtons[i].onClick.AddListener(() => { Debug.LogFormat("Trying to show answer {0}", index); _answerButtons[index].interactable = false; _controller.CorrectAnswer(index); });
            _answerButtons[i].interactable = false;
        }

        _startTimerButton.onClick.AddListener(_controller.StartTimer);
        _startTimerButton.onClick.AddListener(SetStateToWaitingForAnswer);
        _playerPassedButton.onClick.AddListener(_controller.TeamPassed);
        _nextQuestionButton.onClick.AddListener(_controller.NextQuestion);
        _nextQuestionButton.onClick.AddListener(SetStateToWaitingForQuestionPicked);

        for (int i = 0; i < _questionButtons.Length; i++)
        {
            int index = i;
            _questionButtons[i].onClick.RemoveAllListeners();
            _questionButtons[i].onClick.AddListener(() => { Debug.LogFormat("Trying to set question {0}", index); _questionButtons[index].interactable = false; _controller.NextQuestion(index); });
            _questionButtons[i].onClick.AddListener(SetStateWaitingForStartTimer);
            _questionButtons[i].interactable = true;
        }
        _questionCanvas.interactable = false;

        _controller.OnWaitingForNextQuestionPrompt += SetStateToWaitingForNextQuestion;
        _controller.OnWaitingForStartTimer         += SetStateWaitingForStartTimer;
    }
Ejemplo n.º 2
0
    public static void NextRound()
    {
        ++_currentRoundIndex;

        Question[] questions        = null;
        GameRound  currentGameRound = null;

        switch (CurrentRound)
        {
        case Round.ThreeSixNine:
            currentGameRound = new ThreeSixNineRound();
            questions        = GetCurrentRoundQuestions <ThreeSixNineQuestion>();
            break;

        case Round.OpenDoor:
            currentGameRound = new OpenDoorRound();
            questions        = GetCurrentRoundQuestions <OpenDoorQuestion>();
            break;

        case Round.Puzzle:
            currentGameRound = new PuzzleRound();
            questions        = GetCurrentRoundQuestions <PuzzleQuestion>();
            break;

        case Round.Gallery:
            currentGameRound = new GalleryRound();
            questions        = GetCurrentRoundQuestions <GalleryQuestion>();
            break;

        case Round.CollectiveMemory:
            currentGameRound = new CollectiveMemoryRound();
            questions        = GetCurrentRoundQuestions <CollectiveMemoryQuestion>();
            break;

        case Round.Finale:
            currentGameRound = new FinaleRound();
            questions        = GetCurrentRoundQuestions <FinaleQuestion>();
            break;

        case Round.Bonus:
            currentGameRound = new BonusRound();
            break;

        case Round.Done:
            currentGameRound = new DoneRound();
            break;
        }

        SceneManager.Instance.Load(currentGameRound.SceneName, () => currentGameRound.Start(_teams, questions));
    }