private void ExtractLine(ActionSpeech action, bool onlySeekNew, bool isInScene) { string speaker = ""; if (action.isPlayer) { speaker = "Player"; } else if (action.speaker) { speaker = action.speaker.name; } if (speaker != "" && action.messageText != "") { if (onlySeekNew && action.lineID == -1) { // Assign a new ID on creation SpeechLine newLine; if (isInScene) { newLine = new SpeechLine(GetIDArray(), EditorApplication.currentScene, speaker, action.messageText, languages.Count - 1); } else { newLine = new SpeechLine(GetIDArray(), "", speaker, action.messageText, languages.Count - 1); } action.lineID = newLine.lineID; lines.Add(newLine); } else if (!onlySeekNew && action.lineID > -1) { // Already has an ID, so don't replace if (isInScene) { lines.Add(new SpeechLine(action.lineID, EditorApplication.currentScene, speaker, action.messageText, languages.Count - 1)); } else { lines.Add(new SpeechLine(action.lineID, "", speaker, action.messageText, languages.Count - 1)); } } } else { // Remove from SpeechManager action.lineID = -1; } }
public override void ActionSpeechGUI(ActionSpeech action) { #if UNITY_EDITOR action.headClip2D = EditorGUILayout.TextField("Head animation:", action.headClip2D); action.mouthClip2D = EditorGUILayout.TextField("Mouth animation:", action.mouthClip2D); if (GUI.changed) { try { EditorUtility.SetDirty(action); } catch {} } #endif }
public override void ActionSpeechSkip(ActionSpeech action) { if (action.speaker.talkingAnimation == TalkingAnimation.CustomFace && (action.headClip || action.mouthClip)) { AdvGame.CleanUnusedClips(action.speaker.GetComponent <Animation>()); if (action.headClip) { AdvGame.PlayAnimClipFrame(action.speaker.GetComponent <Animation>(), AdvGame.GetAnimLayerInt(AnimLayer.Head), action.headClip, AnimationBlendMode.Additive, WrapMode.Once, 0f, action.speaker.neckBone, 1f); } if (action.mouthClip) { AdvGame.PlayAnimClipFrame(action.speaker.GetComponent <Animation>(), AdvGame.GetAnimLayerInt(AnimLayer.Mouth), action.mouthClip, AnimationBlendMode.Additive, WrapMode.Once, 0f, action.speaker.neckBone, 1f); } } }
public override void ActionSpeechGUI(ActionSpeech action) { #if UNITY_EDITOR if (action.speaker.talkingAnimation == TalkingAnimation.CustomFace) { action.headClip = (AnimationClip)EditorGUILayout.ObjectField("Head animation:", action.headClip, typeof(AnimationClip), true); action.mouthClip = (AnimationClip)EditorGUILayout.ObjectField("Mouth animation:", action.mouthClip, typeof(AnimationClip), true); } if (GUI.changed) { try { EditorUtility.SetDirty(action); } catch {} } #endif }
public override void ActionSpeechRun(ActionSpeech action) { if (action.headClip2D != "" || action.mouthClip2D != "") { Animator animator = GetAnimator(); if (animator == null) { return; } if (action.headClip2D != "") { animator.CrossFade(action.headClip2D, 0.1f, character.headLayer); } if (action.mouthClip2D != "") { animator.CrossFade(action.mouthClip2D, 0.1f, character.mouthLayer); } } }
public override void ActionSpeechGUI(ActionSpeech action) { #if UNITY_EDITOR if (action.speaker.talkingAnimation == TalkingAnimation.CustomFace) { action.play2DHeadAnim = EditorGUILayout.BeginToggleGroup("Custom head animation?", action.play2DHeadAnim); action.headClip2D = EditorGUILayout.TextField("Head animation:", action.headClip2D); action.headLayer = EditorGUILayout.IntField("Mecanim layer:", action.headLayer); EditorGUILayout.EndToggleGroup(); action.play2DMouthAnim = EditorGUILayout.BeginToggleGroup("Custom mouth animation?", action.play2DMouthAnim); action.mouthClip2D = EditorGUILayout.TextField("Mouth animation:", action.mouthClip2D); action.mouthLayer = EditorGUILayout.IntField("Mecanim layer:", action.mouthLayer); EditorGUILayout.EndToggleGroup(); } if (GUI.changed) { EditorUtility.SetDirty(action); } #endif }
public override void ActionSpeechRun(ActionSpeech action) { if (action.speaker.talkingAnimation == TalkingAnimation.CustomFace) { if (action.play2DHeadAnim && action.headClip2D != "") { try { action.speaker.GetComponent <Animator>().Play(action.headClip2D, action.headLayer); } catch {} } if (action.play2DMouthAnim && action.mouthClip2D != "") { try { action.speaker.GetComponent <Animator>().Play(action.mouthClip2D, action.mouthLayer); } catch {} } } }
public override void ActionSpeechSkip(ActionSpeech action) { }
public virtual void ActionSpeechSkip(ActionSpeech action) { ActionSpeechRun(action); }
public virtual void ActionSpeechRun(ActionSpeech action) { }
public virtual void ActionSpeechGUI(ActionSpeech action) { #if UNITY_EDITOR #endif }