Added UpdateBones delegate to more easily adjust bones after the animation is applied.

This commit is contained in:
NathanSweet 2014-01-26 21:03:43 +01:00
parent 41c36a89d3
commit 8506ed5154
2 changed files with 11 additions and 1 deletions

View File

@ -37,7 +37,10 @@ using Spine;
public class SkeletonAnimation : SkeletonComponent {
public bool loop;
public Spine.AnimationState state;
public delegate void UpdateBonesDelegate(SkeletonAnimation skeleton);
public UpdateBonesDelegate UpdateBones;
public String _animationName;
public String animationName {
get {
@ -67,6 +70,8 @@ public class SkeletonAnimation : SkeletonComponent {
// Apply the animation.
state.Update(deltaTime * timeScale);
state.Apply(skeleton);
if (UpdateBones != null) UpdateBones(this);
// Call overridden method to call skeleton Update and UpdateWorldTransform.
base.UpdateSkeleton(deltaTime);

View File

@ -38,6 +38,9 @@ public class SkeletonAnimation : SkeletonComponent {
public bool loop;
public Spine.AnimationState state;
public delegate void UpdateBonesDelegate(SkeletonAnimation skeleton);
public UpdateBonesDelegate UpdateBones;
public String _animationName;
public String animationName {
get {
@ -68,6 +71,8 @@ public class SkeletonAnimation : SkeletonComponent {
state.Update(deltaTime * timeScale);
state.Apply(skeleton);
if (UpdateBones != null) UpdateBones(this);
// Call overridden method to call skeleton Update and UpdateWorldTransform.
base.UpdateSkeleton(deltaTime);
}