Beispiel #1
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();
         }
     }
 }
Beispiel #2
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;
    }
Beispiel #3
0
        private void Awake()
        {
            _rigidbody2D = GetComponent <Rigidbody2D>();

            if (yarnScripts.Length > 0)
            {
                _dialogueRunner = FindObjectOfType <DialogueRunner>();

                foreach (YarnProgram yarnScript in yarnScripts)
                {
                    _dialogueRunner.Add(yarnScript);
                }
            }

            _animator = GetComponent <Animator>();
            AnimationClip[] animationClips = _animator.runtimeAnimatorController.animationClips;
            _animations = new Dictionary <string, string>()
            {
                ["Idle"] = animationClips[0].name,
                ["Walk"] = animationClips[1].name,
                ["Jump"] = animationClips[2].name,
            };

            if (onLandEvent == null)
            {
                onLandEvent = new UnityEvent();
            }
        }
Beispiel #4
0
    /// </summary>
    // Start is called before the first frame update
    void Start()
    {
        if (scriptToLoad == null)
        {
            Debug.LogError("NPC3D not set up with yarn scriptToLoad ", this);
        }
        if (string.IsNullOrEmpty(characterName))
        {
            Debug.LogWarning("NPC3D not set up with characterName", this);
        }
        if (string.IsNullOrEmpty(talkToNode))
        {
            Debug.LogError("NPC3D not set up with talkToNode", this);
        }

        dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>(); //this is bad way to do this but hey we doing this quickly
        if (dialogueRunner == null)
        {
            Debug.LogError("dialogueRunner not set up", this);
        }
        dialogueCanavas = GameObject.Find("Dialogue Canvas"); //this is bad way to do this but hey we doing this quickly
        if (dialogueCanavas == null)
        {
            Debug.LogError("Dialogue Canvas not set up", this);
        }
        if (scriptToLoad != null && dialogueRunner != null && dialogueRunner != null)
        {
            dialogueRunner.Add(scriptToLoad); //adds the script to the dialogue system
        }
    }
Beispiel #5
0
    public void CheckTimeForQuestion()
    {
        DayClass day = days[currentDay];

        if (day.timeToAsk.Length > currentDayQuestion)
        {
            if (day.timeToAsk[currentDayQuestion] == dayTime)
            {
                notificationTittle.text = day.tittle[currentDayQuestion];
                notification.SetActive(true);
                dialogue.Add(day.dayQuestions);
                waitingForOpen = true;
                waitingTime    = timeToOpen;
            }
        }
    }
Beispiel #6
0
    // Start is called before the first frame update
    void Start()
    {
        if (majorConvoNodes.Length != majorConvoTrust.Length)
        {
            Debug.LogError("Error! There are not the same number of MajorConvo nodes and required trust levels!");
            Destroy(this.gameObject);
        }
        gm = GameManager.getInstance();
        ConvertSchedule();
        gm.RegisterInteractable(this.gameObject.transform, this);
        spriteRenderer = this.gameObject.GetComponent <SpriteRenderer>();
        gm.SubscribeDayTimeChangeListener(this);
        rb       = GetComponent <Rigidbody2D>();
        yarnVars = FindObjectOfType <InMemoryVariableStorage>();
        if (scriptToLoad != null)
        {
            dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
            dialogueRunner.Add(scriptToLoad);
        }

        if (!LoadStats())
        {
            majorConvoIndex = 0;
        }


        AddToStart();
        DayTimeChange(gm.currentDay, gm.currentTime);
    }
Beispiel #7
0
 private void LoadPrograms()
 {
     YarnProgram[] programs = Resources.LoadAll <YarnProgram>("Speech");
     foreach (YarnProgram yp in programs)
     {
         runner.Add(yp);
     }
 }
Beispiel #8
0
 void Start()
 {
     if (scriptToLoad != null)
     {
         DialogueRunner dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
         dialogueRunner.Add(scriptToLoad);
     }
 }
Beispiel #9
0
    //this component will be on an object in an exploration scene, and adds the yarn scripts
    //to the list so npcs can access them

    void Start()
    {
        dialogueRunner = FindObjectOfType <DialogueRunner>();
        for (int i = 0; i < yarnScriptsToAdd.Length; i++)
        {
            dialogueRunner.Add(yarnScriptsToAdd[i]);
        }
    }
Beispiel #10
0
 public void LoadScript(YarnProgram scriptToLoad)
 {
     if (scriptToLoad != null)
     {
         DialogueRunner dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
         dialogueRunner.Add(scriptToLoad);
     }
 }
Beispiel #11
0
 void Start()
 {
     if (scriptToLoad != null)
     {
         dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
         dialogueRunner.Add(scriptToLoad);
     }
     dimitri = GameObject.Find("Dimitri");
 }
Beispiel #12
0
    private void Awake()
    {
        if (yarnScripts.Length > 0 || dialogueNodes.Length > 0)
        {
            _dialogueRunner         = FindObjectOfType <DialogueRunner>();
            _dialoguePlacer         = FindObjectOfType <DialoguePlacer>();
            _dialogueVisitedTracker = FindObjectOfType <DialogueVisitedTracker>();

            foreach (YarnProgram yarnScript in yarnScripts)
            {
                _dialogueRunner.Add(yarnScript);
            }
        }

        if (GetComponentInChildren <CinemachineVirtualCamera>() != null)
        {
            _vCam = GetComponentInChildren <CinemachineVirtualCamera>();
            _vCam.gameObject.SetActive(false);

            if (Camera.main != null)
            {
                _mainCam = Camera.main.GetComponent <CinemachineBrain>();
            }
            else
            {
                Debug.LogError("Could not find main camera");
            }

            if (_dialogueRunner != null)
            {
                _dialogueRunner.AddCommandHandler("focusCamera", FocusCamera);
                _dialogueRunner.AddCommandHandler("unFocusCamera", UnFocusCamera);
            }
        }

        if (spriteAnimator != null)
        {
            AnimationClip[] animationClips = spriteAnimator.runtimeAnimatorController.animationClips;

            if (animationClips.Length > animationNames.Length)
            {
                Debug.LogWarning($"NPC {name} has unnamed animationClips");
            }
            else if (animationNames.Length > animationClips.Length)
            {
                Debug.LogError($"NPC {name} has a named animation without animationClip reference");
            }
            else
            {
                _animations = new Dictionary <string, string>();
                for (int i = 0; i < animationClips.Length; i++)
                {
                    _animations.Add(animationNames[i], animationClips[i].name);
                }
            }
        }
    }
    protected virtual void Start()
    {
        dialogueRunner.Clear(); // Clear all loaded nodes upon start. This is needed, as the dialogueRunner will try to load the same nodes when entering a scene multiple times.
        if (yarnScriptToLoad != null)
        {
            dialogueRunner.Add(yarnScriptToLoad);
        }

        player         = GameObject.Find("Player");
        playerAnimator = player.GetComponent <Animator>();
    }
Beispiel #14
0
    protected override void OnArrival()
    {
        //Debug.Log("Checked mail");
        DeHighlight();

        dialogueRunner.Add(dialogueOrganizer.dialoguesPerDays[globalState.currentDay].LetterDialogue);

        dialogueRunner.StartDialogue("Start");

        studioState.mailChecked = true;
    }
Beispiel #15
0
 // Start is called before the first frame update
 void Start()
 {
     if (scriptToLoad != null)
     {
         dialogueRunner.Add(scriptToLoad);
     }
     if (nameText != null)
     {
         nameText.text = characterName;
     }
 }
 public virtual void Start()
 {
     if (dialogueScript != null)
     {
         DialogueRunner dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
         if (!addedPrograms.Contains(dialogueScript))
         {
             dialogueRunner.Add(dialogueScript);
             addedPrograms.Add(dialogueScript);
         }
     }
 }
Beispiel #17
0
 protected void DoAtStart()
 {
     isInRange = false;
     gm        = GameManager.getInstance();
     gm.RegisterInteractable(this.gameObject.transform, this);
     spriteRenderer = this.gameObject.GetComponent <SpriteRenderer>();
     //buttonsEnabled = true;
     dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
     if (scriptToLoad != null)
     {
         dialogueRunner.Add(scriptToLoad);
     }
 }
Beispiel #18
0
        void Start()
        {
            dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
            // do whatever you like
            int day = GameObject.Find("GameController").GetComponent <GameController>().getDay();

            if (day == 1)
            {
                dialogueRunner.Add(scriptToLoad1);
                talkToNode = "ThiruDay1.1";
            }
            else if (day == 2)
            {
                dialogueRunner.Add(scriptToLoad2);
                talkToNode = "Start2";
            }
            else if (day == 3)
            {
                dialogueRunner.Add(scriptToLoad3);
                talkToNode = "Start3";
            }

            dialogueRunner.StartDialogue(talkToNode);
        }
Beispiel #19
0
        void Start()
        {
            if (SceneSaver.Instance.WasDestroyed(this.name))
            {
                Destroy(this.gameObject);
                destroyed = true;
            }

            // TODO: maybe if(used..)

            if (runYarnProgramOnInteraction)
            {
                DialogueRunner dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
                dialogueRunner.Add(programToLoad);
            }
        }
    private IEnumerator PlayDialog(YarnProgram dialog, TimeOfDay time)
    {
        dialogRunner.Add(dialog);

        if (time == TimeOfDay.Morning)
        {
            globalState.playedAMDialog = true;
        }
        if (time == TimeOfDay.Evening)
        {
            globalState.playedPMDialog = true;
        }

        yield return(new WaitForSeconds(dialogStartDelay));

        dialogRunner.StartDialogue("Start");
    }
        internal void SetScripts(params YarnProgram[] scripts)
        {
            if (scripts.IsNullOrEmpty())
            {
                return;
            }

            foreach (var script in scripts)
            {
                if (_registeredScripts.Contains(script))
                {
                    continue;
                }

                _dialogeRunner.Add(script);
                _registeredScripts.Add(script);
            }
        }
Beispiel #22
0
    void Start()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }

        // Loading in the YarnProgram loads in the nodes and strings into the dialogue runner
        if (scriptToLoad != null)
        {
            DialogueRunner dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
            dialogueRunner.Add(scriptToLoad);
            // print(dialogueRunner.CurrentNodeName);
            // print(dialogueRunner.startNode);
            // print(dialogueRunner.NodeExists("Shina"));
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        if (scriptToLoad != null)
        {
            dialogueRunner.Add(scriptToLoad);
        }

        //Debug.Log((nextTutorial < tutorialNodes.Count) + " , " + (tutorialNodes[nextTutorial].minPracticeSessions <= GameManager_Trapeze.GetInstance().GetTimesPlayed()));
        if (GameManager_Trapeze.GetInstance().GetDuoTutorial() && donna.isActiveAndEnabled && !duoTutorialDone)
        {
            dialogueRunner.StartDialogue(duoTutorialNode);
        }
        else if (nextTutorial < tutorialNodes.Count && tutorialNodes[nextTutorial].minPracticeSessions <= GameManager_Trapeze.GetInstance().GetTimesPlayed() && !donna.isActiveAndEnabled)
        {
            dialogueRunner.StartDialogue(tutorialNodes[nextTutorial].name);
        }
        else
        {
            this.gameObject.SetActive(false);
        }
    }
    void Start()
    {
        donnaManager.gameObject.SetActive(duoTrapeze);
        if (gradedPerformance)
        {
            timerText.gameObject.SetActive(true);
            exitBtn.SetActive(false);
        }
        duoTrapeze = false;
        TouchInputManager t = TouchInputManager.getInstance();

        if (t == null)
        {
            Destroy(this);
        }
        trickGUI = TrickGUI.GetInstance();
        t.SubscribeTapListener(this, 0);
        t.SubscribeSwipeListener(this, 0);
        if (playerAvatar == null)
        {
            Debug.Log("Player Avatar is null");
            Destroy(this);
        }
        pmt = playerAvatar.GetComponent <PlayerManager_Trapeze>();
        if (pmt == null)
        {
            Debug.Log("Player Avatar is missing PlayerManager_Trapeze script");
            Destroy(this);
        }
        if (scriptToLoad != null)
        {
            dialogueRunner.Add(scriptToLoad);
        }
        if (canTutorial)
        {
            tutorialManager.SetActive(true);
        }
    }
    public void openGame()
    {
        GameLevel currentLevel = levels[level];

        if (currentLevel.cutscene == true)
        {
            print("cutscene detected");
            dialogue.Add(currentLevel.dialogue);
            dialogueImage.GetComponent <Image>().sprite = currentLevel.imageForDialogue;
            dialogue.StartDialogue("Start");
        }
        else
        {
            preLevel.SetActive(true);
            foreach (GameObject heart in hearts)
            {
                heart.SetActive(true);
            }
            Instantiate(currentLevel.leftSpawner, new Vector3(leftSpawn.position.x, leftSpawn.position.y, leftSpawn.position.z), Quaternion.identity);
            Instantiate(currentLevel.rightSpawner, new Vector3(rightSpawn.position.x, rightSpawn.position.y, rightSpawn.position.z), Quaternion.identity);
            Instantiate(Player, new Vector3(playerSpawn.position.x, playerSpawn.position.y, playerSpawn.position.z), Quaternion.identity);
        }
    }
Beispiel #26
0
 public void SetDayDialogue(int day_number)
 //VARIABLE STILL NOT GETTING APPLIED FROM GAMECONTROLLER, ALSO WE NEED TO HAVE THIS EXECUTE AT THE START OF EVERY PHASE
 //OTHERWISE IT WILL BE UNABLE TO CHANGE
 {
     this.day_number = day_number;
     if (day_number == 2)
     {
         DialogueRunner dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
         dialogueRunner.Add(day_2);
         // if(day_2.baseLocalisationStringTable == null)
         // {
         //     dialogueRunner.AddStringTable(day_2);
         // }
     }
     else if (day_number == 1)
     {
         DialogueRunner dialogueRunner = FindObjectOfType <Yarn.Unity.DialogueRunner>();
         dialogueRunner.Add(day_1);
         // if(day_1.baseLocalisationStringTable == null)
         // {
         //     dialogueRunner.AddStringTable(day_1);
         // }
     }
 }
Beispiel #27
0
 void AddDialogue(YarnProgram dialogueScript)
 {
     DialogueRunner.Add(dialogueScript);
 }
Beispiel #28
0
 public void AddYarnFile(YarnProgram yarnScript)
 => DialogueRunner.Add(yarnScript);
Beispiel #29
0
 /// <summary>
 /// Start a dialogue
 /// </summary>
 /// <param name="script">The script to use for the dialogue</param>
 /// <param name="startNode">The starting node of the script</param>
 public void Talk(YarnProgram script, string startNode)
 {
     dialogueRunner.Add(script);
     dialogueRunner.StartDialogue(startNode);
 }
 private void Start()
 {
     dialogueRunner.Add(yarnDialogue);
     StartCoroutine(WaitForNewPanel());
 }