Author Topic: How to use the "Event Receiver" in Tween and animation?  (Read 3005 times)

xiaoniaojjj

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
How to use the "Event Receiver" in Tween and animation?
« 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?

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Re: How to use the "Event Receiver" in Tween and animation?
« Reply #1 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)