SpriteFactory.Sprite.OnSpriteFrameEnd
C#: void OnSpriteFrameEnd (SpriteFactory.Sprite.FrameEvent frameEvent)
JS: function OnSpriteFrameEnd (frameEvent : SpriteFactory.Sprite.FrameEvent) : void
Description
If the current frame has a frame event, this message will be sent when the frame begins playing. This message is sent to all component siblings of the Sprite.
This can be used to trigger an action each time a frame finishes playing, for example, playing a sound effect during certain frames of a walk cycle or attack animation. To receive this message, place the following in a script and add the script as a component to the same GameObject with the Sprite component.
C#
void OnSpriteFrameEnd(SpriteFactory.Sprite.FrameEvent frameEvent) { if(frameEvent.eventString == "MyEvent") { // place your code here } }
JS
function OnSpriteFrameEnd(frameEvent : SpriteFactory.Sprite.FrameEvent) : void { if(frameEvent.eventString == "MyEvent") { // place your code here } }
See Also
OnSpriteFrameStart