コード例 #1
0
    IEnumerator MyDelay(AvatarShown inputAvatar, string inputMessage, float inputShowDelay, float inputHideDelay)
    {
        if (dialogueHandler == null)
        {
            dialogueHandler = GameObject.Find("DialogueHandler").GetComponent <DialogueHandler>();
        }
        yield return(new WaitForSeconds(inputShowDelay));

        dialogueHandler.showDialogue(inputAvatar, inputMessage);
        yield return(new WaitForSeconds(inputHideDelay));

        iteration++;

        if (message2 != "" && iteration == 1)
        {
            StartCoroutine(MyDelay(avatar2, message2, 0, hideDelay2));
            if (reenableMovement2)
            {
                playerManager.disableInputs = false;
            }
            currentMessage = message2;
        }

        if (message3 != "" && iteration == 2)
        {
            StartCoroutine(MyDelay(avatar3, message3, 0, hideDelay3));
            if (reenableMovement3)
            {
                playerManager.disableInputs = false;
            }
            currentMessage = message3;
        }

        if (message2 == "" || (message2 != "" && iteration == 2) || (message3 != "" && iteration == 3))
        {
            //save state
            PlayerPrefs.SetInt(objectID, 1);
            if (dialogueHandler.GetCurrentMessage() == currentMessage)
            {
                dialogueHandler.hideDialogue();
            }
            if (disableMovement)
            {
                playerManager.disableInputs = false;
            }
        }
    }