예제 #1
0
    public void SetDialogSection(int section)
    {
        placeInDialog = GetDialogIndex(section);
        //NPCText.text = dialogTrigger.dialogObject.dialog[placeInDialog].text;
        StartTextSection(dialogTrigger.dialogObject.dialog[placeInDialog].text);
        if (dialogTrigger.dialogObject.dialog[placeInDialog].conditions.isOneTime)
        {
            DialogVars.Instance.SetVar(dialogTrigger.dialogObject.dialog[placeInDialog].conditions.oneTimeID, true);
        }
        int i = 0;

        for (; i < dialogTrigger.dialogObject.dialog[placeInDialog].responses.Length; i++)
        {
            if (!isDialogConditionsMet(dialogTrigger.dialogObject.dialog[placeInDialog].responses[i]))
            {
                Responses[i].gameObject.SetActive(false);
            }
            else
            {
                Responses[i].gameObject.SetActive(true);
            }
            if (dialogTrigger.dialogObject.dialog[placeInDialog].responses[i].nextID == 0 && dialogTrigger.dialogObject.dialog[placeInDialog].responses[i].eventID == 0)
            {
                //actionTexts[i].text = "{END DIALOG}";
            }
            else if (dialogTrigger.dialogObject.dialog[placeInDialog].responses[i].eventID > 0 &&
                     dialogTrigger.dialogObject.GetEvent(dialogTrigger.dialogObject.dialog[placeInDialog].responses[i].eventID).type == DialogObject.DialogEventType.CloseDialog)
            {
                //actionTexts[i].text = "{END DIALOG}";
            }
            else if (DoesChainEnd(i))
            {
                //actionTexts[i].text = "{END DIALOG}";
            }

            Responses[i].text = dialogTrigger.dialogObject.dialog[placeInDialog].responses[i].response; Responses[i].gameObject.SetActive(true);
        }
        for (; i < Responses.Length; i++)
        {
            Responses[i].gameObject.SetActive(false);
        }
        if (dialogTrigger.dialogObject.dialog[placeInDialog].hasEvent)
        {
            dialogTrigger.RunDialogEvent(dialogTrigger.dialogObject.dialog[placeInDialog].eventID);
        }
        dialogTrigger.animator.CrossFadeInFixedTime("Talk" + dialogTrigger.dialogObject.dialog[placeInDialog].TalkID.ToString(), .2f);
        dialogTrigger.PlayDialogClip(dialogTrigger.dialogObject.dialog[placeInDialog].clip);
    }