Пример #1
0
    IEnumerator RevealCards()
    {
        // Activate reveal text object
        revealText.text = "";
        revealText.gameObject.SetActive(true);
        turnText.text = "Revealing...";

        for (int i = 0; i < 6; i += 2)
        {
            // Wait 2 seconds
            yield return(new WaitForSeconds(2.0f));

            // Activate first placeholder
            placeholders [i].SetCard(turnHistory [i]);
            placeholders [i].gameObject.SetActive(true);
            audioManager.PlaySound("Flip");

            // Set reveal text
            revealText.color = bannerColors[0];
            revealText.text  = turnHistory [i].text;
            yield return(new WaitForSeconds(2.0f));

            // Activate next placeholder
            placeholders[i + 1].SetCard(turnHistory[i + 1]);
            placeholders [i + 1].gameObject.SetActive(true);
            audioManager.PlaySound("Flip");

            // Set reveal text
            revealText.color = bannerColors[1];
            revealText.text  = turnHistory [i + 1].text;
            yield return(new WaitForSeconds(2.0f));

            revealText.color = bannerColors [2];
            revealText.text  = endingCard.GetText();
            yield return(new WaitForSeconds(2.0f));

            revealText.text = "";
        }

        // Get the inactive player ID and ask them for an answer.
        int playerID = inactivePlayer + 1;

        turnText.text = "Player " + playerID + ", select your favourite answer!";

        // Activate the buttons to allow for input
        for (int i = 0; i < buttons.Length; i++)
        {
            buttons [i].gameObject.SetActive(true);
        }

        yield return(null);
    }