StartDialogue() public method

public StartDialogue ( ) : void
return void
    private void OnTriggerEnter(Collider other)
    {
        OurNPC npc = other.gameObject.GetComponentInChildren <OurNPC>();

        //print("Collided with " + other.gameObject.name);
        if (npc != null && npc != lastInteractedNPC)
        {
            if (!hasAddedListener)
            {
                // find the dialogue component and register that we want to know when dialogue ends and allow the player to move
                FindObjectOfType <Yarn.Unity.DialogueUI>().onDialogueEnd.AddListener(() => { DialogueEnded(); });
                hasAddedListener = true;
            }
            if (npc.CanPlay())
            {
                // then try talking with it!
                Yarn.Unity.DialogueRunner runner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
                if (!runner.isDialogueRunning)
                {
                    // don't start the dialogue if it's already talking, we'll have to account for that in our script by checking if we've said things already
                    runner.StartDialogue(npc.talkToNode);
                }
                playerMovement.isAllowedToMove = !runner.isDialogueRunning || canMoveWhileTalking; // only stop the player from moving if dialogue actually starts
                lastInteractedNPC = npc;
                npc.Played();
            }
        }
    }
Ejemplo n.º 2
0
 public void Interact()
 {
     if (!dead)
     {
         dialogRunner.StartDialogue();
     }
 }
Ejemplo n.º 3
0
 public void OnMouseUp()
 {
     if (dr.NodeExists(YarnSummaryNode) && !dr.isDialogueRunning)
     {
         dr.StartDialogue(YarnSummaryNode);
     }
 }
Ejemplo n.º 4
0
    IEnumerator FadeTitleOut()
    {
        Color visible   = new Color(titleFadeOut.color.r, titleFadeOut.color.g, titleFadeOut.color.b, titleFadeOut.color.a);
        Color invisible = new Color(titleFadeOut.color.r, titleFadeOut.color.g, titleFadeOut.color.b, 0);
        float progress  = 0;

        while (progress <= 1)
        {
            titleFadeOut.color = Color.Lerp(visible, invisible, progress);
            progress           = progress + 0.1f;
            yield return(new WaitForSeconds(0.1f));
        }
        titleFadeOut.color = new Color(titleFadeOut.color.r, titleFadeOut.color.g, titleFadeOut.color.b, 0);
        Debug.Log("Fade Finished ");
        yield return(new WaitForSeconds(waitForDialogueStart));

        dialogueRunnerScript.StartDialogue();
    }
Ejemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     if (!SkipIntro)
     {
         StartCoroutine(StartSequence());
     }
     else
     {
         Daphne.TurnON();
         DialogueCanvas.TurnON();
         if (startNode == "")
         {
             startNode = "DAPH02_ThankYou";
         }
         Runner.StartDialogue(startNode);
     }
 }
Ejemplo n.º 6
0
    public void TriggerDialogue(InputAction.CallbackContext context)
    {
        if (m_currTalkableNPC == null)
        {
            return;
        }

        m_dialogueRunner.StartDialogue(m_currTalkableNPC.DialogueNodeName);
        m_playerMovement.StopMovement();
        m_uiManager.SetCurrTalkingPerson(m_currTalkableNPC.DialogueBoxAnchor);
        m_currTalkableNPC.SetInteractable(false, false);
        m_currTalkableNPC.SetTalkAnim(true);

        m_playerControls.Player.Disable();
        m_playerInput.SwitchCurrentActionMap("UI");
        m_uiManager.ToggleInstructions("Dialogue");
        m_playerControls.UI.Enable();
    }
Ejemplo n.º 7
0
    public void EditorTest()
    {
        dialogueUI.ExpectLine("Player: Hey, Sally.");
        dialogueUI.ExpectLine("Sally: Oh! Hi.");
        dialogueUI.ExpectLine("Sally: You snuck up on me.");
        dialogueUI.ExpectLine("Sally: Don't do that.");
        dialogueUI.SelectOption("Anything exciting happen on your watch?");

        dialogueRunner.StartDialogue("Sally");

        // Talking to Sally a second time should result in a different dialogue



        //Act
        //Try to rename the GameObject

        //Assert
        //The object has a new name
        //Assert.AreEqual(newGameObjectName, gameObject.name);
    }
Ejemplo n.º 8
0
 public void TriggerDialogue()
 {
     runnerToTrigger.StartDialogue(node);
 }
Ejemplo n.º 9
0
    private void Introduce()
    {
        // subscribe to buttons
        // unsubscription is automatically done when amdone is pressed
        CustomerInteractionUI.Instance.SubscribeCustomer(
            // called when moremoney button is pressed
            () => moreMoney = true,
            // called when amdone button is pressed
            () => { amDone = true; });

        // Subcribe to end of day to rush out when the bank closes
        App.instance.EndOfDayActive
        .Subscribe(x => { if (x)
                          {
                              amDone = true;
                          }
                   })
        .AddTo(disposables);

        //possible: needs to give you more money
        //possible: can get money
        //possible: can rob
        switch (action)
        {
        case "deposit":
        {
            //speechBubble.text = "Hello my name is " + customerName + " and I want to " + action +" "+ _money +
            //                    " Moneys! my Account Number is " + accountNumber + ".";

            PostitUI.Instance.PublishToPostit(string.Format("{0} ${1} TO {2}",
                                                            action, _money, accountNumber));
            GiveMoney(_money);
            // start dialogue
            dialogueRunner.StartDialogue();
            break;
        }

        case "withdraw":
        {
            //speechBubble.text = "Hello my name is " + customerName + " and I want to " + action +" "+ _money +
            //                    " Moneys! my Account Number is " + accountNumber + ".";
            PostitUI.Instance.PublishToPostit(string.Format("{0} ${1} FROM {2}",
                                                            action, _money, accountNumber));
            // start dialogue
            dialogueRunner.StartDialogue();
            break;
        }

        case "robbery":
        {
            // TODO: DOESNT MAKE SENSE WITH ONLY THE POST IT?!

            //speechBubble.text = "Hands in the air! I want to have "+ _money +
            //                    " Moneys! Give it to me now!";
            PostitUI.Instance.PublishToPostit(string.Format("GIVE ROBBER ${0}", _money));
            _fundCheck = 0;
            // start dialogue
            dialogueRunner.StartDialogue("Robbery");
            break;
        }

        case "makeAccount":
        {
            //speechBubble.text = "Hi I want to make an Account! My name is: " + customerName;
            PostitUI.Instance.PublishToPostit(string.Format("make account for {0}", customerName));
            // start dialogue
            dialogueRunner.StartDialogue();
            break;
        }

        default:
            break;
        }
    }
Ejemplo n.º 10
0
 public void NodeButtonOnClick(string node)
 {
     Debug.Log(node);
     runner.StartDialogue(node);
     DebugCanvas.gameObject.SetActive(false);
 }