public void SetController(ThreeSixNineRound controller)
    {
        _controller = controller;

        _controller.OnWaitingForNextQuestionPrompt += SetStateToWaitingForNextQuestion;

        _nextQuestionButton.onClick.AddListener(_controller.NextQuestion);
        _nextQuestionButton.onClick.AddListener(SetStateToWaitingForAnswer);
        _correctAnswerButton.onClick.AddListener(_controller.AnsweredCorrect);
        _wrongAnswerButton.onClick.AddListener(_controller.AnsweredWrong);
    }
Beispiel #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));
    }
    private void OnDestroy()
    {
        if (_controller != null)
        {
            if (_nextQuestionButton != null)
            {
                _nextQuestionButton.onClick.RemoveListener(_controller.NextQuestion);
            }
            if (_correctAnswerButton != null)
            {
                _correctAnswerButton.onClick.RemoveListener(_controller.AnsweredCorrect);
            }
            if (_wrongAnswerButton != null)
            {
                _wrongAnswerButton.onClick.RemoveListener(_controller.AnsweredWrong);
            }

            _controller.OnWaitingForNextQuestionPrompt -= SetStateToWaitingForNextQuestion;

            _controller = null;
        }
    }