Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: xiaoniaojjj on September 21, 2012, 03:22:41 AM

Title: How to use the "Event Receiver" in Tween and animation?
Post by: xiaoniaojjj on September 21, 2012, 03:22:41 AM
I saw have "Event Receiver" in Tween and animation, how to receive the Event in gameobject,  and what is the event?
could you give some code to explain it?
Title: Re: How to use the "Event Receiver" in Tween and animation?
Post by: Malzbier on September 21, 2012, 04:14:44 AM
I hope this helps.
  1. TweenPosition tweenerP = TweenPosition.Begin (this.gameObject, time, animationTo);
  2. tweenerP.eventReceiver = gameObject; // that game object with is holding the function
  3. tweenerP.callWhenFinished = "Targetfunction"; // the function that gets called when the tween is finnised
  4.  

You tell the tweener that he sould call the function "Targetfunction" on the "gameObject".

You then you just need a script on that game object that have the function "Targetfunction" (btw names are changeable)