コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (isInRange && !triggeredDialogue)
        {
            ShowSpeech();

            speechTrigger.TriggerDialogue();

            //DialogueSystem.Instance.AddNewDialogue(dialogue, npcName);

            triggeredDialogue = true;

            npcMovement.thisInteract = true;

            player.Move(0, 0);
            player.npcInteract();
        }

        else if (isInRange && triggeredDialogue)
        {
            player.npcInteract();

            npcMovement.thisInteract = true;

            if (Input.GetKeyDown(interactKey))
            {
                speechTrigger.DisplayNextSentence();
            }
        }

        else if (!isInRange && triggeredDialogue)
        {
            HideSpeech();

            triggeredDialogue = false;

            npcMovement.thisInteract = false;
        }

        /*
         * if (isInRange && Input.GetKeyDown(interactKey))
         * {
         *
         *  if(!triggeredDialogue)
         *  {
         *
         *
         *  }
         *  else
         *  {
         *
         *      speechTrigger.DisplayNextSentence();
         *
         *      //DialogueSystem.Instance.ContinueDialogue();
         *  }
         *
         * }
         */
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (isInRange && !triggeredDialogue)
        {
            ShowSpeech();

            speechTrigger.TriggerDialogue();

            sentencesLeft -= 1;

            //DialogueSystem.Instance.AddNewDialogue(dialogue, npcName);

            triggeredDialogue = true;

            player.Move(0, 0);
            player.npcInteract();
        }

        else if (isInRange && triggeredDialogue)
        {
            player.npcInteract();

            if (Input.GetKeyDown(interactKey))
            {
                speechTrigger.DisplayNextSentence();

                if (sentencesLeft > 0)
                {
                    sentencesLeft -= 1;
                }
                else if (sentencesLeft <= 0)
                {
                    gameLogic.WinScreen();
                }
            }
        }

        else if (!isInRange && triggeredDialogue)
        {
            HideSpeech();

            triggeredDialogue = false;
        }
    }