コード例 #1
0
ファイル: GameManager.cs プロジェクト: LordDash/slimstemens
    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));
    }
コード例 #2
0
    public void SetController(GalleryRound controller)
    {
        _controller = controller;

        _controller.OnWaitingForNextPlayer    += SetStateWaitingForNextPlayer;
        _controller.OnWaitingForNextQuestion  += SetStateToWaitingForNextQuestion;
        _controller.OnWaitingForAnswersViewed += SetStateToViewAnswers;

        _playerPassedButton.onClick.AddListener(_controller.Pass);
        _nextPictureButton.onClick.AddListener(_controller.ShowNextPicture);
        for (int i = 0; i < _answerButtons.Length; i++)
        {
            int index = i;
            _answerButtons[index].onClick.AddListener(() => { _answerButtons[index].interactable = false; _controller.CorrectAnswer(index); });
        }
        _nextGalleryButton.onClick.AddListener(_controller.NextQuestion);
        _nextGalleryButton.onClick.AddListener(SetStateToWaitingForAnswer);
        _startTimerButton.onClick.AddListener(_controller.StartTimer);
        _startTimerButton.onClick.AddListener(SetStateWaitingForAnswerOfSecondThirdPlayer);
        _nextPlayerButton.onClick.AddListener(_controller.NextTeam);
    }