Esempio n. 1
0
    public override void UpdateState(AudienceMemberController theAudienceMember)
    {
        if (started && theAudienceMember.hasTimer)
        {
            theAudienceMember.currentTime += Time.deltaTime;

            // Updating UI
            float   pos      = theAudienceMember.currentTime / theAudienceMember.maxTime;
            Vector3 newScale = Vector3.one;
            newScale.x = pos;
            Color newColor = Color.Lerp(Color.green, Color.red, pos);

            theAudienceMember.leftFill.transform.localScale = newScale;
            theAudienceMember.leftFill.color = newColor;

            theAudienceMember.rightFill.transform.localScale = newScale;
            theAudienceMember.rightFill.color = newColor;

            // Checking Exit Condition
            if (theAudienceMember.currentTime > theAudienceMember.maxTime)
            {
                LevelManager.instance.IncreaseInstability();
                theAudienceMember.ChangeState(AudienceStates.AUDIENCE_EXIT);
            }
        }
    }
    public void CloseUI(bool questionAnswered)
    {
        // End of dialogue tree
        interactingAudienceMember.success = questionAnswered;
        interactingAudienceMember.ChangeState(AudienceStates.AUDIENCE_EXIT);

        interactingAudienceMember = null;

        // Close All UI
        theQuestionAnswerUI.SetActive(false);
        theDialogueUI.SetActive(false);

        backgroundFade.SetActive(false);
        timerParent.SetActive(false);

        OnEventDialogueFinished?.Invoke();
    }
Esempio n. 3
0
    public override void StartState(AudienceMemberController theAudienceMember)
    {
        // Getting the question to show
        if (theAudienceMember.useGlobalQuestionSet)
        {
            theAudienceMember.theQuestion = QuestionsManager.instance.GetQuestion();
        }
        else
        {
            int pickedQuestion = Random.Range(0, theAudienceMember.possibleStartQuestions.Length);
            theAudienceMember.theQuestion = theAudienceMember.possibleStartQuestions[pickedQuestion];
        }

        // Showing Question To Player
        if (QuestionUIManager.instance.OpenUI(theAudienceMember))
        {
            theAudienceMember.StartCoroutine(this.StartAnim(theAudienceMember));
        }
        else
        {
            theAudienceMember.ChangeState(AudienceStates.AUDIENCE_IDLE, false);
        }
    }