Adding a custom Sequence to all Dialogues
Posted: Tue Apr 23, 2024 7:48 am
Hello!
Thanks for the amazing plugin!
I would like to add my own "lipsync" sequence to all dialogues that currently will only have an audioclip dragged to it.
Right now the sequence field only has an "AudioWait(audioclipname)".
Is there a way to give all dialogue nodes a custom sequence by default while keeping the AudioWait? As I understand, the Dialogue Managers default sequence only runs if there is no sequence added to a dialogue line.
This is the basic code for the lipsync that I want to be fired off at every dialogue line.
Thanks for the amazing plugin!
I would like to add my own "lipsync" sequence to all dialogues that currently will only have an audioclip dragged to it.
Right now the sequence field only has an "AudioWait(audioclipname)".
Is there a way to give all dialogue nodes a custom sequence by default while keeping the AudioWait? As I understand, the Dialogue Managers default sequence only runs if there is no sequence added to a dialogue line.
This is the basic code for the lipsync that I want to be fired off at every dialogue line.
Code: Select all
public class SequencerCommandLipsync : SequencerCommand
{
Animator animator;
AudioSource _audio;
bool Lipsyncing;
public void Start()
{
animator = GetSubject("speaker").GetComponent<Animator>();
_audio = animator.GetComponent<AudioSource>();
}
private void Update()
{
if(_audio.clip != null && _audio.isPlaying)
{
if(Lipsyncing == false)
{
Lipsyncing = true;
animator.Play("Talk", 2);
}
}
else
{
if(Lipsyncing)
{
animator.Play("Stop", 2);
Stop();
}
}
}
}