Page 1 of 3
Talking animation loop (Mecanim)
Posted: Sat Feb 18, 2017 11:12 pm
by harumin
How to match the loop of a talking animation to the size of the dialogue text?
Re: Talking animation loop (Mecanim)
Posted: Sun Feb 19, 2017 10:02 am
by Tony Li
Hi,
Is it just a mouth-open / mouth-close animation? If so, give the character an Animator with two states: one for the talking animation, and another for an idle animation. Let's say they're called "Talk" and "Idle". Then set the dialogue entry's Sequence to:
Code: Select all
AnimatorPlay(Talk);
AnimatorPlay(Idle)@{{end}}
To avoid having to enter this for every dialogue entry, you can instead set the Dialogue Manager's Default Sequence.
Re: Talking animation loop (Mecanim)
Posted: Fri Mar 03, 2017 3:52 am
by harumin
Thanks for the reply. Also, I have a continue button on the UI and i had it on always but, how do I give the next conversation node a delay? When I press continue I wanna give it a delay before proceeding to the next.
Re: Talking animation loop (Mecanim)
Posted: Fri Mar 03, 2017 11:54 am
by Tony Li
So I have it clear: When the player clicks the continue button, it should stop the talking animation, wait for a delay, and then continue to the next stage in the conversation?
If so, here's one way to do that:
1. Change the Sequence to:
Code: Select all
AnimatorPlay(Talk);
AnimatorPlay(Idle)@Message(StopTalking)
2. On the continue button, remove the Unity UI Continue Button Fast Forward if it's there. Instead, add a script like this:
SpecialContinueButton.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class SpecialContinueButton : UnityUITypewriterEffect {
public float delayBeforeContinue = 2;
public override void OnFastForward() {
if ((typewriterEffect != null) && typewriterEffect.IsPlaying) {
typewriterEffect.Stop();
} else {
Sequencer.Message("StopTalking");
Invoke("Continue", delayBeforeContinue);
}
}
public void Continue() {
if (dialogueUI != null) dialogueUI.OnContinue();
}
}
Re: Talking animation loop (Mecanim)
Posted: Sat Mar 04, 2017 10:50 am
by harumin
Thanks a bunch Tony
How do I make Delay() to work? It's only working on conversations that doesn't have a continue button. Example of what I wanna do :
Anemone : We should go back home before the sun sets. (Player clicks continue) (fade out, wait 5 seconds before moving to the next conversation node then fade in.) How do I do it?
Re: Talking animation loop (Mecanim)
Posted: Sat Mar 04, 2017 1:57 pm
by Tony Li
If you want to do this on every dialogue entry, use the SpecialContinueButton.cs script I provided above, but modify it to also fade out and in.
If you only want to do it on specific dialogue entries, here's an example of using an extra dialogue entry node:
FadeDelayExample_2017-03-04.unitypackage
It uses this Sequence:
The Sequence does this:
Time Action
0:00 Fade out
0:01 Show a black cover over the screen (I added "BlackOverlay" to the scene.)
0:06 Hide the black cover
0:06 Fade in
0:07 Continue without requiring the player to click the continue button
Re: Talking animation loop (Mecanim)
Posted: Sat Mar 04, 2017 11:32 pm
by harumin
Thanks. Silly me. I should've consulted the documentation first before posting. Thanks Tony
Re: Talking animation loop (Mecanim)
Posted: Sun Mar 05, 2017 12:27 am
by Tony Li
No worries! If I can help any more with this, please let me know.
Re: Talking animation loop (Mecanim)
Posted: Thu Mar 09, 2017 7:07 am
by harumin
Is it wise to have all conversation entries in just one conversation in the database when making visual novels?
Re: Talking animation loop (Mecanim)
Posted: Thu Mar 09, 2017 9:33 am
by Tony Li
harumin wrote:Is it wise to have all conversation entries in just one conversation in the database when making visual novels?
It's entirely up to you.
The advantage of one conversation is that everything is visible on the same canvas.
You can also use multiple conversations and link between conversations. To add a cross-conversation link, click on the source dialogue entry. From the "Link To:" dropdown, select "Another Conversation". The advantage of multiple conversations is that you can break up your content, which may make it easier for you to organize and navigate it.
In either case, it's usually easiest to have only one entrypoint in your gameplay -- that is, when starting a new game, always start the same conversation.