Пример #1
0
 public override void Interact()
 {
     if (CheckForPickup())
     {
         if (inventoryManager.GetInventory() == "")
         {
             if (scriptToLoad != null)
             {
                 dialogueRunner.StartDialogue(itemName + " Pick Up");
             }
             inventoryManager.SetInventory(this);
             Respawn();
         }
         else
         {
             if (scriptToLoad != null)
             {
                 dialogueRunner.StartDialogue(itemName + " Hands Full");
             }
         }
     }
     else
     {
         if (scriptToLoad != null)
         {
             dialogueRunner.StartDialogue(itemName + " Default");
         }
     }
 }
Пример #2
0
 public void ToDialog()
 {
     if (!dialogue.activeInHierarchy)
     {
         num++;
         DialogueRunner dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
         if (num == 1)
         {
             dialogueRunner.Add(dialog1);
             dialogueRunner.StartDialogue("Start1");
             audio1.Play();
         }
         if (num == 2)
         {
             dialogueRunner.Add(dialog2);
             dialogueRunner.StartDialogue("Start2");
             audio1.Stop();
             audio2.Play();
         }
         if (num == 3)
         {
             dialogueRunner.Add(dialog3);
             dialogueRunner.StartDialogue("Start3");
             audio2.Stop();
             audio3.Play();
         }
     }
 }
Пример #3
0
    IEnumerator ReadyToStartLevel(int level)
    {
        //Time.timeScale = 0;
        mePlayer.transform.localScale = Vector3.one * 1.128379f;
        userControl                 = false;
        mePlayer.natureMoney        = 1;
        mePlayer.borrowMoney        = 0;
        mePlayer.myRig2D.velocity   = Vector2.zero;
        mePlayer.moveRig2D.velocity = Vector2.zero;
        mePlayer.transform.position = Vector3.zero;

        GameObject levelStuff = GameObject.Instantiate(prefabLevels[level - 1]);

        //levelStuff.transform.parent = levelContainer;

        dialogueRunner.StartDialogue("Level" + level);
        while (dialogueRunner.isDialogueRunning)
        {
            yield return(null);
        }

        state = State.Gaming;

        userControl = true;
        //Time.timeScale = 1;
        yield break;
    }
Пример #4
0
 public void StartDailyQustion()
 {
     waitingForOpen = false;
     notification.SetActive(false);
     dialogue.StartDialogue(currentDayQuestion.ToString());
     currentDayQuestion++;
 }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("Fire1") && letter.activeSelf)
        {
            //first a press
            letter.SetActive(false);
            dialogueRunner.StartDialogue("DimitriFirst");
        }

        if (Input.GetButtonDown("Start"))
        {
            GetComponent <AudioSource>().PlayOneShot(QuackFX);
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }

        if (isTheEnd)
        {
            endCanvasGroup.alpha += 0.001f;
        }
        else
        {
            endCanvasGroup.alpha = 0;
        }
    }
Пример #6
0
 // Update is called once per frame
 void Update()
 {
     if (menu.activeSelf == true && Input.GetKeyDown(KeyCode.P))
     {
         menu.SetActive(false);
     }
     else if (Input.GetKeyDown(KeyCode.P))
     {
         menu.SetActive(true);
     }
     // The physics2D detection need testing
     if (Input.GetMouseButtonDown(0) && !dr.IsDialogueRunning &&
         Physics2D.OverlapPoint(UtilsClass.GetMouseWorldPosition()) == null)
     {
         Debug.Log("Start dialogue from click");
         dr.StartDialogue(npc.talkToNode);
     }
     if (Input.GetKeyDown(KeyCode.Space))
     {
         Debug.Log("Start dialogue");
         dr.StartDialogue(npc.talkToNode);
     }
     //if(isDialogRunning && Input Mouse Left Click && options not up?)
     //yarncommand continue dialog / skip autocomplete / go to next line
 }
Пример #7
0
    private void Day0()
    {
        if (numCurrentCustomers == 0 && numCustomersThatLeft == 0)
        {
            Ray        ray     = new Ray(player.GetComponentInChildren <Camera>().transform.position, player.GetComponentInChildren <Camera>().transform.forward);
            float      rayDist = Mathf.Infinity;
            RaycastHit hit     = new RaycastHit();

            if (Physics.Raycast(ray, out hit, rayDist))
            {
                if (hit.transform.name.Contains("InitialCustomerTrigger"))
                {
                    //for snaptriggerarea: if day == 1
                    CustomerIvory.SetActive(true);
                    audioController.spotlightSfx.Play();
                    audioController.bgm1.Play();
                    dialogue.StartDialogue();
                    numCurrentCustomers++;
                }
            }
        }
        if (numCustomersThatLeft == 1)
        {
            CustomerIvory.SetActive(false);
        }
    }
Пример #8
0
    IEnumerator Play()
    {
        nowPlayingText.text = "Now playing: " + schedule.musicSlot.name;
        yield return(new WaitForSeconds(playbackDelay));

        dialogRunner.Add(weather);
        dialogRunner.StartDialogue(Random.Range(1, 6).ToString());
        stage++;

        yield break;
    }
Пример #9
0
 // Start is called before the first frame update
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (visitedTracker == false)
     {
         dialoguerunner.StartDialogue("Acid");
         visitedTracker = true;
     }
     else
     {
         dialoguerunner.StartDialogue("AcidAlt");
     }
 }
Пример #10
0
    public void SwitchFromCloseupMode()
    {
        PlayerInteractionCollider.enabled = true;
        spriteRenderer.enabled            = true;
        isInCloseup = false;
        var nextSceneObject = GameObject.Find("NextScene");
        var nextScene       = nextSceneObject.GetComponent <NextScene>();

        DialogueRunner.StartDialogue(string.Format("{0}.Walk", nextScene.sceneName));
        MenuBar.SwitchToNormalMode();
        CurrentMouseMode = MouseMode.Walk;
    }
Пример #11
0
    public void UseItem(Interactable item, DialogueRunner dialogueRunner)
    {
        string itemApplicationNode = string.Format(ItemApplicationNodeFormat, item.name, name);

        if (dialogueRunner.NodeExists(itemApplicationNode))
        {
            dialogueRunner.StartDialogue(itemApplicationNode);
        }
        else
        {
            dialogueRunner.StartDialogue(DefaultNode);
        }
    }
Пример #12
0
        public IEnumerator TestVariableValuesFromYarnScript()
        {
            // run all lines
            Runner.StartDialogue(Runner.startNode);
            yield return(null);

            VarStorage.TryGetValue <string>("$stringVar", out var actualStringResult);
            Assert.AreEqual("hola", actualStringResult);
            VarStorage.TryGetValue <bool>("$boolVar", out var actualBoolResult);
            Assert.AreEqual(true, actualBoolResult);
            VarStorage.TryGetValue <float>("$floatVar", out var actualFloatResult);
            Assert.AreEqual(1.420f, actualFloatResult);
        }
Пример #13
0
    void HandTouchedEvent(EventE e)
    {
        if ((int)storage.GetValue("$gettingthehint").AsNumber == 1)
        {
            dialogue.StartDialogue("GotTheHint");
        }
        else
        {
            int bustedVal = (int)storage.GetValue("$busted").AsNumber;
            prevNode = dialogue.currentNodeName;

            dialogue.StartDialogue("Busted" + bustedVal);
        }
    }
Пример #14
0
    private void HandleDrop(GameObject DroppedEvidence)
    {
        EvidenceBase curEvidenceBase = DroppedEvidence.GetComponentInChildren <EvidenceBase>();
        string       CommentNode     = ID + curEvidenceBase.ID;

        currentEvidence = curEvidenceBase.gameObject;
        print(curEvidenceBase.ID);
        myStateMachine.ChangeState(curEvidenceBase.ID);
        objectOver = false;
        Main.transform.localScale = initLocalScale;
        if (dr.NodeExists(CommentNode))
        {
            dr.StartDialogue(CommentNode);
        }
    }
Пример #15
0
    private void Update()
    {
        if (IsDialogueAvailable && m_Input.InteractInput && !IsInConversation && TalkToNPCAgainTimer <= 0)
        {
            //Start the dialogue and set everything up
            dialogueRunner.StartDialogue(NPCToTalk.talkToNode, targets);
            SetNormalLineDisplaySpeed();
            IsInConversation      = true;
            TimeBetweenLinesTimer = TimebetweenLinesCooldown;

            //disable movement
            m_Input.ReleaseControl();
        }
        else if (IsInConversation && m_Input.InteractInput && IsLineBeingDisplayed)
        {
            if (TimeBetweenLinesTimer <= 0)
            {
                //Make the line display faster
                dialogueUI.textSpeed = LineDisplaySpeedFast;
            }
        }
        else if (IsInOptions)
        {
            HandleOptions();
        }
        else if (IsInConversation && m_Input.InteractInput)
        {
            dialogueUI.MarkLineComplete();
            TimeBetweenLinesTimer = TimebetweenLinesCooldown;
        }

        //Handle any timers needed
        HandleTimers();
    }
Пример #16
0
    private void OnTriggerEnter(Collider other)
    {
        //if other is player
        if (other.gameObject.CompareTag("Player"))
        {
            if (!string.IsNullOrEmpty(talkToNode))
            {
                if (dialogueCanavas != null)
                {
                    //move the Canvas to the object and off set
                    dialogueCanavas.transform.SetParent(transform.parent.transform); // use the root to prevent scaling
                    //dialogueCanavas.GetComponent<RectTransform>().anchoredPosition3D = transform.parent.TransformVector(PostionSpeachBubble);
                    dialogueCanavas.GetComponent <RectTransform>().anchoredPosition3D = PostionSpeachBubble;
                    dialogueCanavas.GetComponent <RectTransform>().localEulerAngles   = RotationSpeechBubble;
                }

                if (dialogueRunner.IsDialogueRunning)
                {
                    dialogueRunner.Stop();
                }
                Debug.Log("start dialogue");
                dialogueRunner.StartDialogue(talkToNode);
            }
        }
    }
Пример #17
0
    void StartDialogue()
    {
        safeToInteract = true;

        audioController.bgm1.Play();
        dialogueRunner.StartDialogue();
    }
Пример #18
0
    // Update is called once per frame
    void Update()
    {
        if (canInteract && playerControl.canInteract && !interacting && (Input.GetButtonDown("Fire1") || Input.GetButtonDown("Jump")))
        {
            if (characterAnim != null)
            {
                characterAnim.SetTrigger("talk");
            }


            interacting           = true;
            playerControl.canWalk = false;
            dialogueRunner.StartDialogue(nodeName);
        }
        else if (interacting && !dialogueRunner.IsDialogueRunning)
        {
            if (characterAnim != null)
            {
                characterAnim.SetTrigger("stoptalk");
            }

            if (!itemPickedUp)
            {
                itemPickedUp = true;
                AddItemToCollection();
            }

            interacting           = false;
            playerControl.canWalk = true;
            if (destroyOnExamination)
            {
                Destroy(gameObject);
            }
        }
    }
Пример #19
0
 private void NextNode(string nextNode)
 {
     if (nextNode != null)
     {
         runner.StartDialogue(nextNode);
     }
 }
 public override void OnBehaviourPlay(Playable playable, FrameData info)
 {
     if (dialogueRunner != null)
     {
         dialogueRunner.StartDialogue(nodeStart);
     }
 }
Пример #21
0
    public bool Interact(MouseMode mouseMode, DialogueRunner dialogueRunner)
    {
        if (!MouseNodeDictionary.ContainsKey(mouseMode))
        {
            if (string.IsNullOrEmpty(DefaultNode))
            {
                return(false);
            }

            dialogueRunner.StartDialogue(DefaultNode);
            return(true);
        }

        dialogueRunner.StartDialogue(MouseNodeDictionary[mouseMode]);
        return(true);
    }
Пример #22
0
 public void OnInteraction()
 {
     if (isInRange)
     {
         if (!isMajorAction || !GameManager.getInstance().MajorActionDone())
         {
             dialogueRunner.StartDialogue(yarnNode);
         }
         else
         {
             dialogueRunner.StartDialogue(tiredNode);
             //buttonsEnabled = false;
         }
     }
     //TextboxManager.GetInstance().TextBoxActive(true);
 }
 private void EndGradedPerformance()
 {
     if (gradedPerformance)
     {
         //Pause();
         FadeToBlack();
         pauseBtn.SetActive(false);
         gradedPerformance = false;
         timerText.gameObject.SetActive(false);
         trickGUI.FinalScore(targetScore);
         Debug.Log("Performance is done!");
         string node = badEndSolo;
         if (donnaManager.isActiveAndEnabled)
         {
             donnaManager.EnableSprites(false);
             donnaManager.jumpWarning.SetActive(false);
             if (targetScore <= trickGUI.GetScore())
             {
                 node = goodEndDuo;
             }
             else
             {
                 node = badEndDuo;
             }
         }
         else if (targetScore <= trickGUI.GetScore())
         {
             node = goodEndSolo;
         }
         pmt.EnableSprites(false);
         dialogueRunner.StartDialogue(node);
     }
 }
Пример #24
0
 public void StartChat(string nodeName)
 {
     /*
      * Starts dialogue with an NPC, running the node with the passed nodeName.
      */
     dialogueRunner.StartDialogue(nodeName);
 }
Пример #25
0
    private IEnumerator StartDialog()
    {
        yield return(null);

        yield return(null);

        runner.StartDialogue();
    }
Пример #26
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (!cinematicStarted)
     {
         cinematicStarted = true;
         dialogueRunner.StartDialogue("Cinematic Start");
     }
 }
Пример #27
0
    public void ActivateSpeech()
    {
        dR.StartDialogue(GeneralManager.Gm.currentNode.ToString());
        speechBubble.SetActive(true);

        animator.SetBool("EnteredScene", true);
        currentEntered = true;
    }
Пример #28
0
 // Update is called once per frame
 void Update()
 {
     // List<NarrativeEvent> triggered = new List<NarrativeEvent>();
     for (int i = 0; i < narrativeEvents.Length; i++)
     {
         NarrativeEvent ev = narrativeEvents[i];
         if (!ev.triggered && ev.triggerPercentage < comms.PercentageOfJourney && !allDead)
         {
             if (ev.waitForDialogue && dialogueRunner.isDialogueRunning)
             {
                 continue;
             }
             // remove from array and trigger
             if (ev.eventToFire != null)
             {
                 ev.eventToFire.Invoke();
             }
             if (ev.nodeToPlay != null && ev.nodeToPlay != "")
             {
                 dialogueRunner.StartDialogue(ev.nodeToPlay);
             }
             ev.triggered       = true;
             narrativeEvents[i] = ev;
         }
     }
 }
Пример #29
0
 void ChangeToPowered()
 {
     if (!hasStarted)
     {
         dialogueRunner.StartDialogue(startNode);
         hasStarted = true;
     }
     commsUI.gameObject.GetComponent <AudioSource>().mute = false;
 }
Пример #30
0
 public void TalkTo()
 {
     if (isFirstTalk)
     {
         firstMeetingEvents?.Invoke();
         isFirstTalk = false;
     }
     dialogueRunner.StartDialogue(talkToNode);
 }