Beispiel #1
0
    private void Update()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            OnQuitGame();
        }

        if (!showingRecap)
        {
            // After the audition ends, timeSinceAuditionEnded is set to 0. When this value exceeds auditionInterval, the new actor starts arriving on stage whether or not the last one has finished leaving yet.
            if (timeSinceAuditionEnded <= auditionInterval)
            {
                timeSinceAuditionEnded += Time.deltaTime;

                if (timeSinceAuditionEnded > auditionInterval)
                {
                    NextAudition();
                    if (!showingRecap)
                    {
                        timeSinceAuditionStarted = 0.0f; // When this reaches fadeInTime (or immediately if CanInsultWhileAnimating is true), this will cause update to call InsultManager.Instance.OnAuditionStarted())
                        arrivingOnStage          = true;
                        currentAudition.SetActive(true);
                        CastMember cm = currentAudition.GetComponent <CastMember>();
                        cm.SetSilent(false);
                        cm.OnFadeIn(fadeInTime);
                    }
                }
            }
            // The TimeSinceAuditionStarted does not tick up after the end of the previous audition, but it does not reset until the start of the new one (when the new actor starts fading in - after the auditionInterval).
            // Once TimeSinceAuditionStarted has ticked up past fadeInTime (or immediately if canInsultWhileStillArriving is true), InsultManager.Instance.OnAuditionStarted() is called. arrivingOnStage exists to ensure this only happens once per audition.
            else
            {
                timeSinceAuditionStarted += Time.deltaTime;

                if (arrivingOnStage && (canInsultWhileStillArriving || timeSinceAuditionStarted > fadeInTime))
                {
                    arrivingOnStage = false;
                    InsultManager.Instance.OnAuditionStarted();
                }
            }
        }
    }
Beispiel #2
0
    // This function displays the recap scene at the end of the round, from which the player can then move on to the next round.
    private void ShowRecapScene()
    {
        showingRecap = true;
        recapMenu.SetActive(true);
        InsultManager.Instance.OnStopCountdown();

        List <CastMember> cmlist = new List <CastMember>();
        int survivors            = 0;

        foreach (GameObject audition in selectedAuditionsList)
        {
            CastMember cm = audition.GetComponent <CastMember>();
            cm.OnRelax();

            if (cm.GetEliminatedInRound() == currentRound) // Actor was eliminated this round
            {
                cmlist.Add(cm);
            }
            else if (cm.GetEliminatedInRound() == 0) // Actor is still in the game
            {
                cmlist.Add(cm);
                survivors++;
            }
        }

        if (survivors < 1)
        {
            NextRoundButton.SetActive(false);
            AdmitDefeatButton.SetActive(false);
            celebrateVictoryButton.SetActive(true);
        }

        int   auditionsInRound = cmlist.Count;
        float midpoint         = (auditionsInRound - 1) / 2.0f;
        int   i = 0;

        foreach (CastMember cm in cmlist)
        {
            cm.SetSilent(true);
            cm.OnFadeIn(1.0f);
            cm.gameObject.SetActive(true);

            float   pc     = recapScreenPercent / 100.0f;
            float   offset = ((i - midpoint) / (auditionsInRound + 1)) * pc;
            Vector2 pos    = Camera.current.ViewportToWorldPoint(new Vector3(0.5f + offset, 0.5f, 0.0f));
            cm.gameObject.transform.position = pos;

            if (cm.GetEliminatedInRound() == currentRound)
            {
                SpriteRenderer sr = cm.GetSprite();
                sr.material = greyscaleMaterial;
                Color c = sr.color;
                c.r     *= darkenAmount;
                c.g     *= darkenAmount;
                c.b     *= darkenAmount;
                sr.color = c;
            }

            i++;
        }
    }