Пример #1
0
    void Update()
    {
        GameManagerScript gameManager = FindObjectOfType <GameManagerScript>();

        Assert.IsNotNull <GameManagerScript>(gameManager);

        if (gameManager.IsInPostGame())
        {
            sliderText.text = "";

            infoText.enabled      = false;
            countdownText.enabled = false;

            string details = "";

            if (networkedPScript.GetFirstBonus())
            {
                details = "(First to guess: +100)\n";
            }

            int song  = networkedPScript.GetSongID();
            int match = networkedPScript.GetMatchSongID();

            int songTypeIndex = gameManager.GetSongSet();


            if (match != -1)
            {
                answerParent.SetActive(true);
                playerPickedBtn.GetComponent <Image>().color         = ColorScript.GetColor(networkedPScript.picked_color);
                playerPickedBtn.GetComponentInChildren <Text>().text = networkedPScript.picked_color.ToString();
                noGuessText.enabled = false;

                if (song == match)
                {
                    lookingForParent.SetActive(false);

                    answerText.text = "Correct!";
                    details        += "(Found Dance Partner: +250)\n(Time Bonus: +" + networkedPScript.GetTimeBonus() + ")\n";

                    listeningToText.text = "You were dancing to:\n" + AudioManagerScript.GetSongName(songTypeIndex, song);
                }
                else
                {
                    lookingForParent.SetActive(true);

                    lookingForBtn.GetComponent <Image>().color         = ColorScript.GetColor(networkedPScript.match_color);
                    lookingForBtn.GetComponentInChildren <Text>().text = networkedPScript.match_color.ToString();

                    answerText.text = "Wrong!";

                    listeningToText.text = "You heard: " + AudioManagerScript.GetSongName(songTypeIndex, song) + "\nThey heard: " + AudioManagerScript.GetSongName(songTypeIndex, match);
                }
            }
            else
            {
                lookingForParent.SetActive(false);
                answerParent.SetActive(false);
                noGuessText.enabled = true;

                listeningToText.text = "You were dancing to:\n" + AudioManagerScript.GetSongName(songTypeIndex, song);
            }

            finalScoreText.text = "Score: +" + networkedPScript.GetScoredThisRound().ToString();

            if (networkedPScript.GetWasGuessed())
            {
                details += "(Partner found you: +500)";
            }

            if (details != "")
            {
                details = "Score breakdown:\n" + details;
            }

            detailsText.text = details;

            continuingInText.text = "Automatically continuing in " + Mathf.CeilToInt(gameManager.endgameCountDown);
        }
        else
        {
            float countDown = gameManager.countDown;

            float captainsCountdown = networkedPScript.captainsCountdown;
            if (captainsCountdown > 0)
            {
                sliderText.text  = "";
                infoText.enabled = true;

                if (captainsCountdown < 1)
                {
                    infoText.text = "DANCE!";
                }
                else if (captainsCountdown >= (4f)) //Plus one second for the "Dance" end
                {
                    infoText.text = "Ready?";
                }
                else
                {
                    infoText.text = "" + Mathf.Floor(captainsCountdown);
                }
            }
            else if (countDown > 0)
            {
                bool chosen = (networkedPScript.GetMatchSongID() == -1);
                if (chosen)
                {
                    sliderText.text = "Chose your dance partner:";
                }
                else
                {
                    sliderText.text = "Press back to undo current choice";
                }
                infoText.enabled      = false;
                countdownText.enabled = true;
                countdownText.text    = "" + Mathf.Ceil(countDown);

                if (reminded == false)
                {
                    if (countDown < 30 && chosen)
                    {
                        Debug.Log("Reminder to pick!");
                        AudioManagerScript.instance.PlayFind();
                        reminded = true;
                    }
                }
            }
            else
            {
                sliderText.text  = "Other players:";
                infoText.enabled = false;
            }
        }
    }