Tasharen Entertainment Forum

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.

  1. void BeginTalk () {
  2. var Typewriter = Text.AddComponent<TypewriterEffect> ();
  3. CharacterAnimator.SetBool ("Talk", true);
  4. Typewriter.onFinished = StopTalking()
  5. }
  6.  
  7. public void StopTalking(){
  8. CharacterAnimator.SetBool ("Talk", false);
  9. }
  10.  

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);