[Unity] Updated SkeletonAnimationInterface to include GetSkeleton to avoid additional GetComponents.

This commit is contained in:
Fenrisul 2015-05-02 00:36:45 -07:00
parent 65ef51d6bc
commit 7facdba396
3 changed files with 9 additions and 1 deletions

View File

@ -42,7 +42,9 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
public bool loop; public bool loop;
public Spine.AnimationState state; public Spine.AnimationState state;
public Skeleton GetSkeleton(){
return this.skeleton;
}
public event UpdateBonesDelegate UpdateLocal { public event UpdateBonesDelegate UpdateLocal {
add { _UpdateLocal += value; } add { _UpdateLocal += value; }

View File

@ -31,6 +31,7 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Spine;
public delegate void UpdateBonesDelegate (SkeletonRenderer skeletonRenderer); public delegate void UpdateBonesDelegate (SkeletonRenderer skeletonRenderer);
public interface ISkeletonAnimation { public interface ISkeletonAnimation {
@ -39,4 +40,5 @@ public interface ISkeletonAnimation {
event UpdateBonesDelegate UpdateComplete; event UpdateBonesDelegate UpdateComplete;
void LateUpdate (); void LateUpdate ();
Skeleton GetSkeleton();
} }

View File

@ -15,6 +15,10 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
public enum MixMode { AlwaysMix, MixNext, SpineStyle } public enum MixMode { AlwaysMix, MixNext, SpineStyle }
public MixMode[] layerMixModes = new MixMode[0]; public MixMode[] layerMixModes = new MixMode[0];
public Skeleton GetSkeleton () {
return this.skeleton;
}
public event UpdateBonesDelegate UpdateLocal { public event UpdateBonesDelegate UpdateLocal {
add { _UpdateLocal += value; } add { _UpdateLocal += value; }
remove { _UpdateLocal -= value; } remove { _UpdateLocal -= value; }