public SaveHelper_Chunk(ChunkChange Change)
        {
            m_Helpers = new Dictionary <int, SaveHelper_Section>();
            m_Changes = Change.Data;

            foreach (var cha in m_Changes)
            {
                m_Helpers.Add(cha.Height, new SaveHelper_Section(cha));
            }
        }
Exemple #2
0
        /// <summary>
        /// Read a line, applies the proper changes and readies to read the next line.
        /// </summary>
        public void ReadLine()
        {
            if (lineIndex >= CurrentDialogueChunk.Lines.Length)                     //No more lines in this chunk, prevents error
            {
                Debug.LogWarning("[SCENE] No more lines to read in the current Dialogue Chunk");
                if (!text.GetComponent <TypewriterModuleUI>().Reveal(CurrentDialogueChunk.Lines[lineIndex - 1].Text.Length))
                {
                    return;                                                                                                         //Typewriter-reveal text management
                }
                return;
            }

            line = CurrentDialogueChunk.Lines[lineIndex];

            if (!text.GetComponent <TypewriterModuleUI>().Reveal(line.Text.Length))
            {
                return;                                                                         //If the function was called to reveal the text
            }
            if (line.Text != "")
            {
                text.text = line.Text;
            }

            if (currentSpeaker != line.Speaker)                 //Mangage speaker if it changed since the last line
            {
                ChangeSpeaker(line.Speaker);
                currentSpeaker = line.Speaker;
            }

            int length = line.CharacterMovement.Count;

            for (int i = 0; i < length; i++)                    //Manage character movements for this line, in order
            {
                if (line.CharacterMovement[i] is ChangeChunk)
                {
                    ChunkChange = line.CharacterMovement[i].Move;                                               //Manage the dialogue chunk changes
                }
                line.CharacterMovement[i].Move();
            }

            if (line.Speaker.CheckState())                      //Manage the character forms changes with stats
            {
                ChangeSpeakerState(line.Speaker);
            }

            if (line.Anonymous)
            {
                speakerName.text = "???";
            }
            else
            {
                speakerName.text = line.Speaker.CharacterName;
            }

            UpdateCharacterSprite();                            //Manage sprite displayed with form & emotion
            if (line is DialogueChoice)
            {
                DisplayChoice();
            }


            lineIndex++;

            ChunkChange?.Invoke();          //Change chunk at the end if necessary
            ChunkChange = null;
        }