コード例 #1
0
    void LateUpdate()
    {
        if (Input.GetKeyDown(KeyCode.L))
        {
            LoadGame();
        }

        if (Input.GetButtonDown("Start") && pauseEnabled)
        {
            if (!paused)
            {
                Pause();
            }
            else
            {
                Unpause();
            }
        }

        if (inAbilityGetUI && Input.GetButtonDown("Jump"))
        {
            HideAbilityGetUI();
        }

        if (Input.GetButtonDown("Inventory"))
        {
            if (pc.inCutscene && inventory.inventoryUI.animator.GetBool("Shown"))
            {
                CloseInventory();
            }
            else if (!pc.inCutscene && pc.IsGrounded())
            {
                OpenInventory();
            }
        }

        if (
            dialogueOpen &&
            (Input.GetButtonDown("Submit") || Input.GetButtonDown("Jump")) &&
            !dialogueOpenedThisFrame &&
            !inCutscene
            )
        {
            if (dialogueUI.slowRendering)
            {
                dialogueUI.CancelSlowRender();
                return;
            }

            if (dialogueUI.switchingImage)
            {
                dialogueUI.SwitchSpeakerImage();
            }

            //advance dialogue line or close
            //if necessary, hit the activatable from the previous line
            //and block dialogue/enter cutscene if necessary
            if (toActivate != null)
            {
                toActivate.activatable.Activate();
                if (toActivate.blocking)
                {
                    //block dialogue line rendering and hide dialogue UI
                    EnterCutscene();
                    //don't render the dialogue
                    toActivate = null;
                    return;
                }
                toActivate = null;
            }

            DialogueLine nextLine = currentNPC.GetNextLine();

            if (nextLine != null)
            {
                dialogueUI.RenderDialogueLine(nextLine, currentNPC.hasNextLine());
                if (nextLine.activatable != null)
                {
                    if (!nextLine.activatesOnLineEnd)
                    {
                        nextLine.activatable.Activate();
                    }
                    else
                    {
                        toActivate = nextLine;
                    }
                }
            }
            else
            {
                ExitDialogue();
            }
        }
        dialogueOpenedThisFrame = false;
        dialogueClosedThisFrame = false;

        UpdateControllerStatus();
    }
コード例 #2
0
    public static void OnDialogueSkip()
    {
        if (!dialogueOpen || dialogueOpenedThisFrame || inAnimationCutscene)
        {
            return;
        }

        if (dialogueOpen && openUIs > 1)
        {
            return;
        }

        if (dialogueUI.slowRendering)
        {
            dialogueUI.CancelSlowRender();
            return;
        }

        if (dialogueUI.switchingImage)
        {
            dialogueUI.SwitchSpeakerImage();
        }

        //advance dialogue line or close
        //if necessary, hit the activatable from the previous line
        //and block dialogue/enter cutscene if necessary
        if (toActivate != null)
        {
            toActivate.activatable.Activate();
            if (toActivate.blocking)
            {
                //block dialogue line rendering and hide dialogue UI
                EnterCutscene();
                //don't render the dialogue
                toActivate = null;
                return;
            }
            toActivate = null;
        }

        DialogueLine nextLine = currentNPC.GetNextLine();

        if (nextLine != null)
        {
            dialogueUI.RenderDialogueLine(
                nextLine,
                currentNPC.hasNextLine() || queuedNPCs.Count > 0
                );
            if (nextLine.activatable != null)
            {
                if (!nextLine.activatesOnLineEnd)
                {
                    nextLine.activatable.Activate();
                }
                else
                {
                    toActivate = nextLine;
                }
            }
        }
        else
        {
            ExitDialogue();
        }
    }
コード例 #3
0
    void LateUpdate()
    {
        if (
            dialogueOpen &&
            (Input.GetButtonDown("Submit") || Input.GetButtonDown("Jump")) &&
            !dialogueOpenedThisFrame &&
            !inCutscene
            )
        {
            if (dialogueUI.slowRendering)
            {
                dialogueUI.CancelSlowRender();
                return;
            }

            if (dialogueUI.switchingImage)
            {
                dialogueUI.SwitchSpeakerImage();
            }

            //advance dialogue line or close
            //if necessary, hit the activatable from the previous line
            //and block dialogue/enter cutscene if necessary
            if (toActivate != null)
            {
                toActivate.activatable.Activate();
                if (toActivate.blocking)
                {
                    //block dialogue line rendering and hide dialogue UI
                    EnterCutscene();
                    //don't render the dialogue
                    toActivate = null;
                    return;
                }
                toActivate = null;
            }

            DialogueLine nextLine = currentNPC.GetNextLine();

            if (nextLine != null)
            {
                dialogueUI.RenderDialogueLine(nextLine);
                if (nextLine.activatable != null)
                {
                    if (!nextLine.activatesOnLineEnd)
                    {
                        nextLine.activatable.Activate();
                    }
                    else
                    {
                        toActivate = nextLine;
                    }
                }
            }
            else
            {
                ExitDialogue();
            }
        }
        dialogueOpenedThisFrame = false;
        dialogueClosedThisFrame = false;
    }