コード例 #1
0
        private void AddNextLetter()
        {
            if (SentenceToDisplay.Length < _MessageToSpeak.Length)
            {
                if (_CurrentPauseIndex < _PauseIndexes.Count)
                {
                    if (SentenceToDisplay.Length >= _PauseIndexes[_CurrentPauseIndex])
                    {
                        if (_MessageToSpeak[SentenceToDisplay.Length - 1] == ',' || _MessageToSpeak[SentenceToDisplay.Length - 1] == '.' || _MessageToSpeak[SentenceToDisplay.Length - 1] == '!' || _MessageToSpeak[SentenceToDisplay.Length - 1] == '?')
                        {
                            PauseVoice(175);
                            _TimeUntilNextLetter = 220;
                        }

                        _CurrentPauseIndex++;
                    }

                    else
                    {
                        _TimeUntilNextLetter = 25;
                    }
                }

                else
                {
                    _TimeUntilNextLetter = 25;
                }

                SentenceToDisplay += _MessageToSpeak[SentenceToDisplay.Length];
            }

            else
            {
                Finished      = true;
                FaceToDisplay = "/Underlauncher;component/Assets/Images/Characters/" + _Character.ToString() + "/" + _Reaction.ToString() + "/" + "1.png";
            }
        }
コード例 #2
0
        public CharacterSpeech(Characters chara, Constants.CharacterReactions react, string message)
        {
            _Character      = chara;
            _Reaction       = react;
            _MessageToSpeak = message;

            SentenceToDisplay    = "";
            _TimeUntilNextLetter = 25;
            Finished             = false;
            _VoicePaused         = false;
            FaceToDisplay        = "/Underlauncher;component/Assets/Images/Characters/" + _Character.ToString() + "/" + _Reaction.ToString() + "/" + "1.png";
            _CurrentAnimImage    = 1;

            bool seOK = MXA2SE.startup();

            soundEngine = MXA2SE.create_sound_engine();

            AnalyzeSpeech();
        }