コード例 #1
0
    protected IEnumerator Start()
    {
        // If not coming from Lobby
        if (mode == Modes.UNESPECIFIED)
        {
            // Play game music
            UIMaster.PlayMusic(UIMaster.Musics.Game);

            // Set correct mode, so testing works
            string modeName = manager.GetType().Name;
            mode = (Modes)Enum.Parse(typeof(Modes), modeName);
        }
        // Reset game stats for both players
        Player.Get(1).ranking = new GameStats();
        Player.Get(2).ranking = new GameStats();

        // Start rounds
        for (int round = 1; round <= rounds; round++)
        {
            stopped = true;
            // Display round info
            yield return(RoundDisplay.Show(round, roundWinner));

            roundWinner = -1;
            stopped     = false;

            // Start actual game mode logic
            var logic = StartCoroutine(Logic());

            // Wait until winner is proclaimed
            while (roundWinner == -1)
            {
                yield return(null);
            }
            StopCoroutine(logic);
        }

        // At the end of the game
        stopped = true;
        UIMaster.PlayEffect(UIMaster.SFx.Whistle);
        yield return(new WaitForSeconds(1f));

        StartCoroutine(ResetStage());
        UIMaster.ShowRanking();
    }