void eventModeUpdate() { if (audiosource.isPlaying == false) { if (currentevent <= 1) { audiosource.clip = bgm_sound; audiosource.Play(); } } if (talkmode != TalkMode.EVENT) { return; } if (currentevent == 0) { talkTextClear(); if (staging.fadeOutBlack()) { currentevent++; } return; } if (currentevent == 1) { if (staging.fadeInBlack()) { talkmode = TalkMode.NORMAL; currentevent++; return; } } }
public IEnumerator SpeakProcedure(string clipName, TalkMode mode = TalkMode.Default, bool remainInConversation = false) { StopWalking(); PlayerBrain.interruptFlag = false; interruptingSentence = false; if (!staticCharacter) { SwitchToTalking(); animator.SetInteger("talkMode", (int)mode); } animator.SetBool("talking", true); yield return(StartCoroutine(PlayerBrain.Talk(clipName))); if (!interruptingSentence) { if (!remainInConversation) { if (!staticCharacter) { SwitchToIdle(); } } } animator.SetBool("talking", false); }
/// <summary> /// Update the game settings relative to the mic settings. /// This is called in your SettingsManager for your game, or wherever mic information should be updated. /// This is also called in Start to default values. /// </summary> public void UpdateValues() { //replace this logic with however youd like to handle updating and storing saved information on mic preferences from the player voiceThreshold = SettingsManager.targetMic.voiceThreshold; activeMic = SettingsManager.targetMic.mic; talkMode = SettingsManager.targetMic.talkMode; selfMuted = SettingsManager.targetMic.selfMuted; }
void eventModeUpdate() { if (audiosource.isPlaying == false) { if (currentevent <= 1) { audiosource.clip = bgm_sound; audiosource.Play(); } if (currentevent == 4) { audiosource.clip = building_sound; audiosource.Play(); } } if (talkmode != TalkMode.EVENT) { return; } if (currentevent == 0) { talkTextClear(); audiosource.clip = hungry_sound; audiosource.Play(); talkmode = TalkMode.NORMAL; currentevent++; return; } if (currentevent == 1) { talkTextClear(); if (staging.fadeOutBlack()) { background.sprite = roombackground; audiosource.clip = building_sound; audiosource.Play(); currentevent++; } } if (currentevent == 2) { if (staging.fadeInBlack()) { talkmode = TalkMode.NORMAL; currentevent++; return; } } if (currentevent == 3) { talkTextClear(); audiosource.clip = doorclose_sound; audiosource.Play(); talkmode = TalkMode.NORMAL; currentevent++; return; } if (currentevent == 4) { var color = background.color; color.r -= 0.01f; color.g -= 0.01f; color.b -= 0.01f; background.color = color; if (color.r <= 0) { talkmode = TalkMode.NORMAL; currentevent++; return; } } if (currentevent == 5) { var color = background.color; color.r += 0.01f; color.g += 0.01f; color.b += 0.01f; background.color = color; if (color.r >= 1.0f) { talkmode = TalkMode.NORMAL; currentevent++; return; } } if (currentevent == 6) { var color = background.color; color.r -= 0.01f; color.g -= 0.01f; color.b -= 0.01f; background.color = color; if (color.r <= 0) { talkmode = TalkMode.NORMAL; currentevent++; return; } } if (currentevent == 7) { if (staging.fadeOutBlack()) { nowloadingtexture.SetActive(true); talkmode = TalkMode.NORMAL; currentevent++; return; } } }
/// <summary> /// 渡されたテキストを分解して表示する文字列に保存する関数 /// </summary> /// <param name="loadtext_">読み込んだ文字列</param> void textDataCheck(string loadtext_) { char[] chara_array = loadtext_.ToCharArray(); int texturecount = 0; for (int i = current_read_line; i < chara_array.Length; i++) { string command = null; // メモ書きの判定 if (chara_array[i] == '/') { if (chara_array[i + 1] == '/') { while (true) { i++; if (chara_array[i] == '\n') { break; } } continue; } } // コマンド開始 if (chara_array[i] == '[') { command = commandSearch(loadtext_, i); if (command != "end") { i += command.Length + 2; } } // 名前開始 else if (chara_array[i] == '#') { draw_name = commandSearch(loadtext_, i); if (draw_name != null) { i += draw_name.Length + 1; } else { draw_name = " "; for (int k = i + 1; k < chara_array.Length; k++) { if (chara_array[k] == '#') { i = k; break; } } } continue; } // 会話の種類 (普通の会話や選択肢など) if (command == "text") { talkmode = TalkMode.NORMAL; } else if (command == "root") { talkmode = TalkMode.SELECT; } else if (command == "event") { talkmode = TalkMode.EVENT; } if (talkmode == TalkMode.NORMAL) { // コマンドを探すswitch文 switch (command) { case "p": talkCharInstance('\n', font_defaultsize, Color.white); continue; case "n": current_read_line = i; return; case "end": talkTextClear(); SceneManager.LoadScene("GameMain"); return; } if (command != null) { // キャラを表示させるコマンドが来たら通る if (command.IndexOf("chara") != -1) { if (texturecount == 0) { texturename1 = commandPickOutName(command); } else if (texturecount == 1) { texturename2 = commandPickOutName(command); } texturecount++; } // エフェクトが来たら通る if (command.IndexOf("effect") != -1) { } string pickoutcommand = null; // サイズを変えるコマンドが来たら通る if (command.IndexOf("size") != -1) { pickoutcommand = commandPickOutName(command); if (pickoutcommand == "start") { fontsize = font_bigsize; } else if (pickoutcommand == "end") { fontsize = font_defaultsize; } } // 色変えるコマンドが来たら通る bool is_colorchange = false; Color changecolor = Color.white; if (command.IndexOf("red") != -1) { changecolor = Color.red; is_colorchange = true; } if (is_colorchange) { pickoutcommand = commandPickOutName(command); if (pickoutcommand == "start") { fontcolor = changecolor; } else if (pickoutcommand == "end") { fontcolor = Color.black; } } } if (chara_array[i] == '(') { string rootnum_st = commandSearch(loadtext_, i); i += rootnum_st.Length + 1; int rootnum = int.Parse(rootnum_st); if (rootnum == selectbuttonnum) { while (true) { i++; if (chara_array[i] == '{') { break; } } } else { while (true) { i++; if (chara_array[i] == '}') { break; } } } continue; } if (chara_array[i] == ' ' || chara_array[i] == '\r' || chara_array[i] == '\n') { continue; } // 会話文に追加 talkCharInstance(chara_array[i], fontsize, fontcolor); } if (talkmode == TalkMode.SELECT) { string rootcommand = null; if (chara_array[i] == '(') { rootcommand = commandSearch(loadtext_, i); rootButtonSetting(rootcommand); i += rootcommand.Length + 2; is_selectbuttonpush = false; continue; } } if (talkmode == TalkMode.EVENT) { current_read_line = i; return; } } }
public void Speak(string clipName, TalkMode mode = TalkMode.Default) { StartCoroutine(SpeakProcedure(clipName, mode)); }