mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Show using a lambda for callbacks.
This commit is contained in:
parent
305aabfc8a
commit
3a506300eb
@ -41,6 +41,10 @@ public class Spineboy : MonoBehaviour {
|
|||||||
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
||||||
// Call our method any time an animation fires an event.
|
// Call our method any time an animation fires an event.
|
||||||
skeletonAnimation.state.Event += Event;
|
skeletonAnimation.state.Event += Event;
|
||||||
|
// A lambda can be used for the callback instead of a method.
|
||||||
|
skeletonAnimation.state.End += (state, trackIndex) => {
|
||||||
|
Debug.Log("start: " + state.GetCurrent(trackIndex));
|
||||||
|
};
|
||||||
// Queue jump to be played on track 0 two seconds after the starting animation.
|
// Queue jump to be played on track 0 two seconds after the starting animation.
|
||||||
skeletonAnimation.state.AddAnimation(0, "jump", false, 2);
|
skeletonAnimation.state.AddAnimation(0, "jump", false, 2);
|
||||||
// Queue walk to be looped on track 0 after the jump animation.
|
// Queue walk to be looped on track 0 after the jump animation.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user