コード例 #1
0
 public SpeechChunkController(NSFController nsfcontroller, SpeechChunk speechchunk) : base(nsfcontroller, speechchunk)
 {
     this.speechchunk      = speechchunk;
     Node.Text             = "Speech Chunk";
     Node.ImageKey         = "speechchunk";
     Node.SelectedImageKey = "speechchunk";
 }
コード例 #2
0
ファイル: Monologue.cs プロジェクト: BenjiBoy926/Prodigy
 // Immediately display the full text of the speech chunk specified
 private void ImmediatelyDisplayChunk(SpeechChunk chunk)
 {
     chunk.DisplayFullText();
     skipReady      = false;
     skipReadyTimer = chunkInterval + Time.time;
     SoundPlayer.Instance.PlayRandomEffect(voiceClips);
 }
コード例 #3
0
        private void Menu_Add_SpeechChunk()
        {
            SpeechChunk chunk = new SpeechChunk();

            nsf.Chunks.Add(chunk);
            SpeechChunkController controller = new SpeechChunkController(this, chunk);

            AddNode(controller);
        }
コード例 #4
0
ファイル: Monologue.cs プロジェクト: BenjiBoy926/Prodigy
    // Gradually reveal the speech chunk character by character
    private IEnumerator GraduallyRevealChunk(SpeechChunk chunk)
    {
        int currentChar = 0;            // Current character of the chunk being revealed

        // Activate display of the chunk
        chunk.DisplayActive(true);

        // Loop while current character is less than the characters in the text
        while (currentChar < chunk.theText.Length)
        {
            // Add a character to the display
            chunk.AddChar(currentChar);

            // If the character we added wasn't white space, play a sound effect
            if (chunk.theText [currentChar] != ' ')
            {
                SoundPlayer.Instance.PlayRandomEffect(voiceClips);
            }

            // Wait statements inside the selection
            // Don't bother waiting at all if the text is already full displayed
            if (!(chunk.textFullyDisplayed))
            {
                // If the character added is a punctuation mark, wait for a little more time
                if (Monologue.punctuation.Contains(chunk.theText [currentChar]))
                {
                    // Wait slightly longer if a sentence just ended
                    // as opposed to a mid-sentence pause with a comma or colon
                    if (chunk.theText [currentChar] == '.' ||
                        chunk.theText [currentChar] == '!' ||
                        chunk.theText [currentChar] == '?')
                    {
                        yield return(new WaitForSeconds(endSentencePause));
                    }
                    else
                    {
                        yield return(new WaitForSeconds(midSentencePause));
                    }             // END if end-of-sentence punctuation
                }                 // END if punctuation

                yield return(new WaitForSeconds(chunk.timeBetweenChars));
            }             // END if fully displayed

            // Increment current character before moving on
            currentChar++;
        }

        // Start skip ready timer
        skipReady      = false;
        skipReadyTimer = chunkInterval + Time.time;
    }