Support => NGUI 3 Support => Topic started by: Littlenorwegians on June 27, 2017, 03:05:23 PM
Title: Typewriter OnFinished(), stop animation
Post by: Littlenorwegians on June 27, 2017, 03:05:23 PM
Hello!
Having a bit of an issue here. Basically I'm adding a typewriter component to a gameobject via my script, and setting its variables. Like fadeintime, charspersecond and so on.
But I also want to make it so that when the typewriter component is finished it will broadcast a message. (Basically, I want it to disable an animation bool of an animator. Sort of when the typewriter effect is done it stops a talking animation)
To put it in blunt, wrong code.
void BeginTalk (){
var Typewriter = Text.AddComponent<TypewriterEffect>();
CharacterAnimator.SetBool("Talk", true);
Typewriter.onFinished= StopTalking()
}
publicvoid StopTalking(){
CharacterAnimator.SetBool("Talk", false);
}
How would I got about assigning/setting up a proper delegate here. I'm a little confused :)
Title: Re: Typewriter OnFinished(), stop animation
Post by: ArenMook on July 06, 2017, 05:30:24 AM
Same as any other NGUI delegate. EventDelegate.Add(typewriter.onFinished, yourDelegate);