Ejemplo n.º 1
0
        private void Talk_btn_Click(object sender, EventArgs e)
        {

            //再生
            state = talker.Speak(textBox1.Text);
            state.Wait();
        }
Ejemplo n.º 2
0
    void ChooseAReaction(ReactionType rt, ReactionCategory rc)
    {
        VoiceLine tempReaction = reactions[Random.Range(0, reactions.Length)];

        if (tempReaction == currentReaction)
        {
            ChooseAReaction(rt, rc);
        }
        else
        {
            currentReaction = tempReaction;
        }

        boredumLevelTimer = (rt == ReactionType.Event) ? timeUntilNextBoredumLevel : boredumLevelTimer;

        currentReaction.spriteSheet.animationFinished = false;
        currentReaction.spriteSheet.index             = 0;
        currentReaction.audio.audioStarted            = false;
        currentReaction.audio.audioFinished           = false;
        currentReaction.text.subtitlesFinished        = false;
        currentReaction.text.subtitleTimer            = 0;

        speakingState = (rt == ReactionType.Event) ? SpeakingState.Speaking : SpeakingState.IdleSpeaking;

        /*foreach (VoiceLine vl in reactions)
         * {
         *  vl.tried = false;
         * }*/
    }
Ejemplo n.º 3
0
 public void PauseSpeaking()
 {
     DialogBackground.SetActive(false);
     NextDialogIcon.SetActive(false);
     speaking           = SpeakingState.PAUSED;
     currentLetterIndex = 0;
 }
Ejemplo n.º 4
0
 private void UpdateDialogs()
 {
     if (speaking == SpeakingState.SPEAKING)
     {
         lastDeltaTime += Time.deltaTime;
         if (lastDeltaTime > TimeBetweetLetters)
         {
             if (currentLetterIndex < currentDialog.Length)
             {
                 DialogObject.text = currentDialog.Substring(0, currentLetterIndex);
                 currentLetterIndex++;
                 lastDeltaTime = 0f;
             }
             else
             {
                 // dialog file has ended
                 speaking = SpeakingState.WAITING_INPUT;
                 NextDialogIcon.SetActive(true);
             }
         }
         else
         {
             // wait for the time between letters
             return;
         }
     }
     else
     {
         // currently not speaking
         return;
     }
 }
Ejemplo n.º 5
0
    private string getDialogFileContent(string file_name)
    {
        string file_path = BASE_PATH +
                           GetFolderFromLanguaje(languaje) +
                           RoomName + '/' +
                           file_name + ".txt";

        string file_content = null;

        if (System.IO.File.Exists(file_path))
        {
            StreamReader reader = new StreamReader(file_path);
            file_content = reader.ReadToEnd();
            reader.Close();

            file_content = CleanDialogString(file_content);
        }
        else
        {
            speaking = SpeakingState.FINISHED;
        }

        PlaySoundEffect(file_content);

        currentLetterIndex = 0;
        return(file_content);
    }
Ejemplo n.º 6
0
 public void StopSpeaking()
 {
     DialogBackground.SetActive(false);
     NextDialogIcon.SetActive(false);
     speaking = SpeakingState.FINISHED;
     DialogFinished();
 }
Ejemplo n.º 7
0
 void CheckFinished()
 {
     if (currentReaction.spriteSheet.animationFinished && currentReaction.audio.audioFinished && currentReaction.text.subtitlesFinished)
     {
         speakingState = SpeakingState.Idol;
     }
 }
Ejemplo n.º 8
0
    private void Update()
    {
        if (currentReaction == null)
        {
            speakingState = SpeakingState.Idol;
        }
        if (speakingState == SpeakingState.Idol)
        {
            ChooseAReaction(ReactionType.Idol, idolState);
        }


        if ((speakingState != SpeakingState.Idol) && currentReaction != null)
        {
            PlayAudio();
            CycleSpriteSheet();
            DisplaySubtitles();
            CheckFinished();
        }

        if (speakingState != SpeakingState.Speaking)
        {
            if (boredumLevelTimer < 0)
            {
                NextIdolState();
                attempts = reactions.Length;
                ChooseAReaction(ReactionType.Idol, idolState);
            }
            else
            {
                boredumLevelTimer -= Time.deltaTime;
            }
        }
    }
Ejemplo n.º 9
0
 void ChooseAReaction(ReactionType rt, ReactionCatagory rc)
 {
     currentReaction = reactions[Random.Range(0, reactions.Length)];
     if ((currentReaction.reactionType != rt || currentReaction.reactionCatagory != rc) && attempts >= 0)
     {
         if (!currentReaction.tried)
         {
             currentReaction.tried = true;
             attempts--;
         }
         ChooseAReaction(rt, rc);
         return;
     }
     else if (attempts <= 0)
     {
         if (reactions.Length > 0)
         {
             currentReaction = reactions[0];
         }
     }
     attempts = reactions.Length;
     foreach (VoiceLine vl in reactions)
     {
         vl.tried = false;
     }
     boredumLevelTimer = (rt == ReactionType.Event) ? timeUntilNextBoredumLevel: boredumLevelTimer;
     currentReaction.spriteSheet.animationFinished = false;
     currentReaction.spriteSheet.index             = 0;
     currentReaction.audio.audioStarted            = false;
     currentReaction.audio.audioFinished           = false;
     currentReaction.text.subtitlesFinished        = false;
     currentReaction.text.subtitleTimer            = 0;
     speakingState = (rt == ReactionType.Event) ? SpeakingState.Speaking : SpeakingState.IdolSpeaking;
 }
Ejemplo n.º 10
0
 void CheckFinished()
 {
     //If all the parametres that distinguish an 'Event' return a finished state, set speaking state to Idle
     if (currentReaction.spriteSheet.animationFinished && currentReaction.audio.audioFinished && currentReaction.text.subtitlesFinished)
     {
         speakingState = SpeakingState.Idle;
     }
 }
Ejemplo n.º 11
0
    private void Start()
    {
        audioSource = GetComponent <AudioSource>();

        if (currentReaction == null)
        {
            speakingState = SpeakingState.Idle;
        }
    }
Ejemplo n.º 12
0
        internal static void Talk(string text)
        {
            ServiceControl.StartHost(false);
            Talker talker = new Talker();

            talker.Cast = "さとうささら";
            SpeakingState state = talker.Speak(text);

            state.Wait();
        }
Ejemplo n.º 13
0
    private void Awake()
    {
        currentFileCounter = -1;
        currentLetterIndex = 0;
        speaking           = SpeakingState.NOT_STARTED;
        suspiciousGuard    = false;
        confessingGuard    = false;

        DialogBackground.SetActive(false);
        NextDialogIcon.SetActive(false);
    }
Ejemplo n.º 14
0
 public void StartSpeaking()
 {
     DialogBackground.SetActive(true);
     NextDialogIcon.SetActive(false);
     speaking = SpeakingState.SPEAKING;
 }