Example #1
0
 void DisplaySubtitles()
 {
     //is the current not subtitle finshed
     if (!currentReaction.text.subtitlesFinished)
     {
         //advance subtitle counter
         currentReaction.text.subtitleTimer += Time.deltaTime;
         //is the previous subtitle different to the current subtitle
         if (subtitleField.text != currentReaction.text.subtitles)
         {
             tweenAnimator.TweenToOutPos();
             //set the previous subtitle to the new subtitle
             subtitleField.text = currentReaction.text.subtitles;
         }
         // if the current has reached its allocated timer
         if (currentReaction.text.subtitleTimer > currentReaction.text.subtitleDisplayTime)
         {
             tweenAnimator.TweenToInPos();
             //set the current reaction state the finished
             currentReaction.text.subtitlesFinished = true;
         }
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (!winnerFound || winnerCalled == true)
        {
            if (winnerCalled)
            {
                winnerCalled = false;
            }

            CalculateWinnerFromScore();

            if (winner == Team.TEAM1)
            {
                team1.color = Color.green;
                team1.text  = "WINNER";

                team2.color = Color.red;
                team2.text  = "LOSER";

                tweenAnimator1.TweenToInPos();
                tweenAnimator2.TweenToInPos();

                winnerFound = true;

                for (int i = 0; i < componentsToDisable.Length; i++)
                {
                    componentsToDisable[i].SetActive(false);
                }

                //Time.timeScale = 0;

                quitToMenuButton.SetActive(true);
                rematchButton.SetActive(true);
            }
            else if (winner == Team.TEAM2)
            {
                team1.color = Color.red;
                team1.text  = "LOSER";

                team2.color = Color.green;
                team2.text  = "WINNER";

                tweenAnimator1.TweenToInPos();
                tweenAnimator2.TweenToInPos();

                winnerFound = true;

                for (int i = 0; i < componentsToDisable.Length; i++)
                {
                    componentsToDisable[i].SetActive(false);
                }

                //Time.timeScale = 0;

                quitToMenuButton.SetActive(true);
                rematchButton.SetActive(true);
            }
            else if (isDraw)
            {
                tweenAnimator3.TweenToInPos();

                winnerFound = true;

                for (int i = 0; i < componentsToDisable.Length; i++)
                {
                    componentsToDisable[i].SetActive(false);
                }

                //Time.timeScale = 0;

                quitToMenuButton.SetActive(true);
                rematchButton.SetActive(true);
            }
        }
        else if (winnerFound)
        {
            quitToMenuButton.SetActive(true);
            rematchButton.SetActive(true);
        }
    }