Exemple #1
0
        void Awake()
        {
            // if Ropework manager is null, then find it
            if (ropework == null)
            {
                ropework = FindObjectOfType <Ropework.RopeworkManager>();
            }

            // Start by hiding the container, line and option buttons
            if (dialogueContainer != null)
            {
                dialogueContainer.SetActive(false);
            }

            lineText.gameObject.SetActive(false);

            foreach (var button in optionButtons)
            {
                button.gameObject.SetActive(false);
            }

            // Hide the continue prompt if it exists
            if (continuePrompt != null)
            {
                continuePrompt.SetActive(false);
            }

            // Set the text speed from user settings
            this.textSpeed = SaveGameManager.GetCurrentGame().TextSpeed;
        }
Exemple #2
0
 /// <inheritdoc />
 /// <summary>
 /// Save the new value to the current save game whenever the value gets changed.
 /// </summary>
 /// <param name="input"></param>
 /// <param name="sendFeedBack"></param>
 protected override void Set(float input, bool sendFeedBack)
 {
     base.Set(input, sendFeedBack);
     if (sendFeedBack)
     {
         SaveGameManager.GetCurrentGame().TextSpeed = 1f - input;
     }
 }
Exemple #3
0
        /// <summary>
        /// When the component awakes, it populates the container panel with given chapters.
        /// </summary>
        private void Awake()
        {
            // The (said) starting point ID, we are guessing data is ordered.
            var id = 1;

            // Retrieve the saved played chapters.
            var playedChapters = SaveGameManager.GetCurrentGame().PlayedChapters;

            // Note that the previous chapter was not completed
            // if there are completed chapters.
            // That will allow us to hide every chapter after the next one to be completed.
            var previousWasCompleted = playedChapters.Count < 1;

            // Populate the container panel with chapters
            foreach (var chapter in this.ListOfChapters)
            {
                // Flag the chapter as completed if it is in the list of completed chapters.
                var isCompleted = playedChapters.Contains(chapter.YarnAsset.name);

                // Add the chapter on the container panel
                this.AddChapter(id++, chapter, isCompleted);

                // If the previous chapter was completed and the current one wasn't,
                // don't show the next chapters.
                if (previousWasCompleted && !isCompleted)
                {
                    break;
                }

                // If the chapter was completed, flag that the previous chapter (this one) was completed.
                if (isCompleted)
                {
                    previousWasCompleted = true;
                }
            }
        }
Exemple #4
0
 public void RegisterChoice(int chapterId, int questionId, int answerId)
 {
     SaveGameManager.GetCurrentGame().ChoiceHistory.RegisterChoice(
         chapterId, questionId, answerId);
 }
Exemple #5
0
 /// <summary>
 /// Set the current speed as value on the slider when the component awakes.
 /// But make it human readable, instead of having the quickest speed on the left,
 /// put them on the right.
 /// </summary>
 protected override void OnEnable()
 {
     base.OnEnable();
     this.Set(1f - SaveGameManager.GetCurrentGame().TextSpeed, false);
 }