Пример #1
0
 private void PlayLetterSound(DialoguePiece piece)
 {
     if (letterSoundSource.isPlaying)
     {
         letterSoundSource.Stop();
     }
     letterSoundSource.clip  = piece.letterSound;
     letterSoundSource.pitch = UnityEngine.Random.Range(piece.actor.voicePitchRangeLow, piece.actor.voicePitchRangeHigh);
     letterSoundSource.Play();
 }
Пример #2
0
        IEnumerator RunningDialoguePiece(DialoguePiece piece, Mode mode)
        {
            bool isSkip = false;

            actorName.text    = piece.actor.name;
            portrait.sprite   = piece.spriteReaction;
            dialogueText.text = "";
            PlaySound(piece);
            foreach (char c in piece.dialogueText)
            {
                dialogueText.text += c;
                if (c != ' ')
                {
                    for (int i = 0; i < piece.speed * currentDialogue.timeForTypeOut; i++)
                    {
                        if (Input.GetKeyDown(skipButton) || mode == Mode.Instant)
                        {
                            dialogueText.text = piece.dialogueText;
                            isSkip            = true;
                            break;
                        }
                        yield return(null);
                    }
                    if (isSkip)
                    {
                        break;
                    }
                    PlayLetterSound(piece);
                    yield return(null);
                }
            }
            yield return(null);

            yield return(StartCoroutine(WaitForInput()));

            NextDialoguePiece();
        }
Пример #3
0
 private void PlaySound(DialoguePiece piece)
 {
     genericSoundSource.clip = piece.sound;
     genericSoundSource.Play();
 }