Author Topic: Typewriter OnFinished(), stop animation  (Read 1547 times)

Littlenorwegians

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Typewriter OnFinished(), stop animation
« 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 :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Typewriter OnFinished(), stop animation
« Reply #1 on: July 06, 2017, 05:30:24 AM »
Same as any other NGUI delegate. EventDelegate.Add(typewriter.onFinished, yourDelegate);