public void StartMotion(string group, int no, int priority, bool loop) { _loop = loop; _currentMontionIndex = no; string motionName = modelSetting.GetMotionFile(group, no); if (motionName == null || motionName.Equals("")) { if (L2DConst.DEBUG_LOG) { Debug.Log("Motion name is invalid"); } return; } if (priority == L2DConst.PRIORITY_FORCE) { mainMotionManager.setReservePriority(priority); } else if (!mainMotionManager.reserveMotion(priority)) { if (L2DConst.DEBUG_LOG) { Debug.Log("Do not play because book already playing, or playing a motion already." + motionName); } return; } AMotion motion = null; string name = group + "_" + no; if (motions.ContainsKey(name)) { motion = motions[name]; } if (motion == null) { motion = loadMotion(name, _baseDir + motionName); } if (motion == null) { Debug.Log("Failed to read the motion." + motionName); mainMotionManager.setReservePriority(0); return; } motion.setFadeIn(modelSetting.GetMotionFadeIn(group, no)); motion.setFadeOut(modelSetting.GetMotionFadeOut(group, no)); mainMotionManager.startMotionPrio(motion, priority); }
public void SetExpression(string name, bool noFade) { if (!expressions.ContainsKey(name)) { Debug.LogError("[L2DModel.InvalidExpresssion]" + name); return; } AMotion motion = expressions[name]; int fadeIn = (noFade) ? 0 : Define.L2D._expressionFadeDefault; int fadeOut = (noFade) ? 0 : Define.L2D._expressionFadeDefault; motion.setFadeIn(fadeIn); motion.setFadeOut(fadeOut); expressionManager.startMotion(motion, false); }
/// <summary> /// 지정한 모션 재생 /// <para>우선순위, 동일 애니 재생여부 고려하지 않고 진행중인 애니메이션 덮어 씀</para> /// </summary> private void StartMotion(string group, bool noFade) { const int no = 0; string motionName = _modelSetting.GetMotionFile(group, no); if (string.IsNullOrEmpty(motionName)) { Debug.LogError("Motion name is invalid. group:" + group + " no:" + no.ToString()); return; } AMotion motion = null; string name = group + "_" + no; if (motions.ContainsKey(name)) { motion = motions[name]; } if (motion == null) { motion = loadMotion(name, _modelHomeDir + motionName); } if (motion == null) { Debug.LogError("Failed to read the motion." + motionName); return; } int fadeIn = (noFade) ? 0 : _modelSetting.GetMotionFadeIn(group, no); int fadeOut = (noFade) ? 0 : _modelSetting.GetMotionFadeOut(group, no); motion.setFadeIn(fadeIn); motion.setFadeOut(fadeOut); mainMotionManager.startMotionPrio(motion, Define.L2D._priorityForce); }
/* *开始运动。 *检查您是否可以播放,如果不能这样做,则无所事事。 *如果您可以自动播放,请阅读文件并进行播放。 *如果它有声音,它也会播放。 *如果您有关于淡入和淡出的信息,请在此处设置。 如果没有初始值。 */ public void StartMotion(string group, int no, int priority) { string motionName = modelSetting.GetMotionFile(group, no); if (motionName == null || motionName.Equals("")) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Motion name is invalid"); } return;// } //将新动作的优先级与当前正在播放的动作,保留动作的优先级进行比较 //如果可以预约(如果优先级高)则保留播放。 // //在此帧中立即播放保留的新动作,或者如果需要加载声音等。 //在以下帧开始播放。 if (priority == LAppDefine.PRIORITY_FORCE) { mainMotionManager.setReservePriority(priority); } else if (!mainMotionManager.reserveMotion(priority)) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Do not play because book already playing, or playing a motion already." + motionName); } return; } AMotion motion = null; string name = group + "_" + no; if (motions.ContainsKey(name)) { motion = motions[name]; } if (motion == null) { motion = loadMotion(name, modelHomeDir + motionName); } if (motion == null) { Debug.Log("Failed to read the motion." + motionName); mainMotionManager.setReservePriority(0); return; } // フェードイン、フェードアウトの設定 motion.setFadeIn(modelSetting.GetMotionFadeIn(group, no)); motion.setFadeOut(modelSetting.GetMotionFadeOut(group, no)); if ((modelSetting.GetMotionSound(group, no)) == null) { // 音声が無いモーションは即時再生を開始します。 if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName); } mainMotionManager.startMotionPrio(motion, priority); } else { // 音声があるモーションは音声のロードを待ってから再生を開始します。 string soundPath = modelSetting.GetMotionSound(group, no); soundPath = Regex.Replace(soundPath, ".mp3$", "");// 不要な拡張子を削除 AudioClip acVoice = FileManager.LoadAssetsSound(modelHomeDir + soundPath); if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName + " voice : " + soundPath); } StartVoice(acVoice); mainMotionManager.startMotionPrio(motion, priority); } }
public void startMotion(string name, int no, int priority) { Debug.Log("starting motion name: " + name); string motionName = modelSetting.getMotionFile(name, no); if (motionName == null || motionName.Equals("")) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Motion name is invalid"); } return; // } //overwrites the force priority /*if (priority == LAppDefine.PRIORITY_FORCE) { * mainMotionManager.setReservePriority(priority); * } * else*/if (!mainMotionManager.reserveMotion(priority)) { Debug.Log("Do not play because book already playing, or playing a motion already"); if (LAppDefine.DEBUG_LOG) { Debug.Log("Do not play because book already playing, or playing a motion already"); } return; } AMotion motion = FileManager.loadAssetsMotion(motionName); if (motion == null) { Debug.Log("Failed to read the motion."); mainMotionManager.setReservePriority(0); return; } motion.setFadeIn(modelSetting.getMotionFadeIn(name, no)); motion.setFadeOut(modelSetting.getMotionFadeOut(name, no)); if ((modelSetting.getMotionSound(name, no)) == null) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName); } mainMotionManager.startMotionPrio(motion, priority); } else { string soundPath = modelSetting.getMotionSound(name, no); soundPath = Regex.Replace(soundPath, ".mp3$", "");//不要な拡張子を削除 AudioClip acVoice = FileManager.loadAssetsSound(soundPath); if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName + " voice : " + soundPath); } startVoiceMotion(motion, acVoice, priority); } }
/* * モーションの開始。 * 再生できる状態かチェックして、できなければ何もしない。 * 再生出来る場合は自動でファイルを読み込んで再生。 * 音声付きならそれも再生。 * フェードイン、フェードアウトの情報があればここで設定。なければ初期値。 */ public void StartMotion(string group, int no, int priority) { string motionName = modelSetting.GetMotionFile(group, no); if (motionName == null || motionName.Equals("")) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Motion name is invalid"); } return;// } // 新しいモーションのpriorityと、再生中のモーション、予約済みモーションのpriorityと比較して // 予約可能であれば(優先度が高ければ)再生を予約します。 // // 予約した新モーションは、このフレームで即時再生されるか、もしくは音声のロード等が必要な場合は // 以降のフレームで再生開始されます。 if (priority == LAppDefine.PRIORITY_FORCE) { mainMotionManager.setReservePriority(priority); } else if (!mainMotionManager.reserveMotion(priority)) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Do not play because book already playing, or playing a motion already." + motionName); } return; } AMotion motion = null; string name = group + "_" + no; if (motions.ContainsKey(name)) { motion = motions[name]; } if (motion == null) { motion = loadMotion(name, modelHomeDir + motionName); } if (motion == null) { Debug.Log("Failed to read the motion." + motionName); mainMotionManager.setReservePriority(0); return; } // フェードイン、フェードアウトの設定 motion.setFadeIn(modelSetting.GetMotionFadeIn(group, no)); motion.setFadeOut(modelSetting.GetMotionFadeOut(group, no)); if ((modelSetting.GetMotionSound(group, no)) == null) { // 音声が無いモーションは即時再生を開始します。 if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName); } mainMotionManager.startMotionPrio(motion, priority); } else { // 音声があるモーションは音声のロードを待ってから再生を開始します。 string soundPath = modelSetting.GetMotionSound(group, no); soundPath = Regex.Replace(soundPath, ".mp3$", "");// 不要な拡張子を削除 AudioClip acVoice = FileManager.LoadAssetsSound(modelHomeDir + soundPath); if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName + " voice : " + soundPath); } StartVoice(acVoice); mainMotionManager.startMotionPrio(motion, priority); } }
public void StartMotion(string group, int no, int priority) { string motionName = modelSetting.GetMotionFile(group, no); if (motionName == null || motionName.Equals("")) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Motion name is invalid"); } return;// } // if (priority == LAppDefine.PRIORITY_FORCE) { mainMotionManager.setReservePriority(priority); } else if (!mainMotionManager.reserveMotion(priority)) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Do not play because book already playing, or playing a motion already." + motionName); } return; } AMotion motion = null; string name = group + "_" + no; if (motions.ContainsKey(name)) { motion = motions[name]; } if (motion == null) { motion = loadMotion(name, modelHomeDir + motionName); } if (motion == null) { Debug.Log("Failed to read the motion." + motionName); mainMotionManager.setReservePriority(0); return; } motion.setFadeIn(modelSetting.GetMotionFadeIn(group, no)); motion.setFadeOut(modelSetting.GetMotionFadeOut(group, no)); if ((modelSetting.GetMotionSound(group, no)) == null) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName); } mainMotionManager.startMotionPrio(motion, priority); } else { string soundPath = modelSetting.GetMotionSound(group, no); soundPath = Regex.Replace(soundPath, ".mp3$", ""); AudioClip acVoice = FileManager.LoadAssetsSound(modelHomeDir + soundPath); if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName + " voice : " + soundPath); } StartVoice(acVoice); mainMotionManager.startMotionPrio(motion, priority); } }
/* * モーションの開始。 * 再生できる状態かチェックして、できなければ何もしない。 * 再生出来る場合は自動でファイルを読み込んで再生。 * 音声付きならそれも再生。 * フェードイン、フェードアウトの情報があればここで設定。なければ初期値。 */ public void StartMotion(string group, int no, int priority) { string motionName = modelSetting.GetMotionFile(group, no); if (motionName == null || motionName.Equals("")) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Motion name is invalid"); } return;// } // 新しいモーションのpriorityと、再生中のモーション、予約済みモーションのpriorityと比較して // 予約可能であれば(優先度が高ければ)再生を予約します。 // // 予約した新モーションは、このフレームで即時再生されるか、もしくは音声のロード等が必要な場合は // 以降のフレームで再生開始されます。 if (priority == LAppDefine.PRIORITY_FORCE) { mainMotionManager.setReservePriority(priority); } else if (!mainMotionManager.reserveMotion(priority)) { if (LAppDefine.DEBUG_LOG) { Debug.Log("Do not play because book already playing, or playing a motion already." + motionName); } return; } AMotion motion = null; string name = group + "_" + no; if (motions.ContainsKey(name)) { motion = motions[name]; } if (motion == null) { motion = loadMotion(name, modelHomeDir + motionName); } if (motion == null) { Debug.Log("Failed to read the motion." + motionName); mainMotionManager.setReservePriority(0); return; } // フェードイン、フェードアウトの設定 motion.setFadeIn(modelSetting.GetMotionFadeIn(group, no)); motion.setFadeOut(modelSetting.GetMotionFadeOut(group, no)); if ((modelSetting.GetMotionSound(group, no)) == null) { // 音声が無いモーションは即時再生を開始します。 if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName); } mainMotionManager.startMotionPrio(motion, priority); TextBoxManager.StartText(group, no); } else { // 音声があるモーションは音声のロードを待ってから再生を開始します。 string soundPath = modelSetting.GetMotionSound(group, no); soundPath = Regex.Replace(soundPath, ".mp3$", "");// 不要な拡張子を削除 AudioClip acVoice = FileManager.LoadAssetsSound(modelHomeDir + soundPath); if (LAppDefine.DEBUG_LOG) { Debug.Log("Start motion : " + motionName + " voice : " + soundPath); } StartVoice(acVoice); mainMotionManager.startMotionPrio(motion, priority); TextBoxManager.StartText(group, no); } //追加 独自に音声再生 if (LAppLive2DManager.sceneIndex == 1) { if (motionName == "motions/m_3.mtn") { AudioSource[] surval = GameObject.Find("Live2D_Canvas_Surval").GetComponents <AudioSource> (); surval [2].PlayOneShot(surval [2].clip); //うぎゃーーーー } else if (motionName == "motions/m_2.mtn") { AudioSource[] surval = GameObject.Find("Live2D_Canvas_Surval").GetComponents <AudioSource> (); System.Random r = new System.Random(); if (r.Next(0, 10) < 4) { surval [3].PlayOneShot(surval [3].clip); //わーーい } else if (r.Next(0, 10) > 6) { surval [0].PlayOneShot(surval [0].clip); //きもちーー } else { surval [1].PlayOneShot(surval [1].clip); //たーのしー } } } }