mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 10:16:01 +08:00
Merge branch 'master' of git://github.com/EsotericSoftware/spine-runtimes
This commit is contained in:
commit
2034a6e726
@ -29,9 +29,12 @@ public class tk2dSpineSkeleton : MonoBehaviour, tk2dRuntime.ISpriteCollectionFor
|
|||||||
vertexPositions = new float[8];
|
vertexPositions = new float[8];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update () {
|
void Start () {
|
||||||
SkeletonData skeletonData = (skeletonDataAsset != null) ? skeletonDataAsset.GetSkeletonData() : null;
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update () {
|
||||||
|
SkeletonData skeletonData = skeletonDataAsset == null ? null : skeletonDataAsset.GetSkeletonData();
|
||||||
if (skeletonData == null) {
|
if (skeletonData == null) {
|
||||||
Clear();
|
Clear();
|
||||||
return;
|
return;
|
||||||
@ -46,6 +49,7 @@ public class tk2dSpineSkeleton : MonoBehaviour, tk2dRuntime.ISpriteCollectionFor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void Clear() {
|
private void Clear() {
|
||||||
|
Debug.Log("clear?!");
|
||||||
GetComponent<MeshFilter>().mesh = null;
|
GetComponent<MeshFilter>().mesh = null;
|
||||||
DestroyImmediate(mesh);
|
DestroyImmediate(mesh);
|
||||||
mesh = null;
|
mesh = null;
|
||||||
@ -161,14 +165,12 @@ public class tk2dSpineSkeleton : MonoBehaviour, tk2dRuntime.ISpriteCollectionFor
|
|||||||
|
|
||||||
private void UpdateAnimation() {
|
private void UpdateAnimation() {
|
||||||
// Check if we need to stop current animation
|
// Check if we need to stop current animation
|
||||||
if(state.Animation != null && animationName == null) {
|
if (state.Animation != null && animationName == null) {
|
||||||
state.ClearAnimation();
|
state.ClearAnimation();
|
||||||
}
|
} else if (state.Animation == null || animationName != state.Animation.Name) {
|
||||||
|
// Check for different animation name or animation end
|
||||||
// Check for different animation name or animation end
|
|
||||||
else if(state.Animation == null || animationName != state.Animation.Name) {
|
|
||||||
Spine.Animation animation = skeleton.Data.FindAnimation(animationName);
|
Spine.Animation animation = skeleton.Data.FindAnimation(animationName);
|
||||||
if(animation != null) state.SetAnimation(animation,loop);
|
if (animation != null) state.SetAnimation(animation,loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.Loop = loop;
|
state.Loop = loop;
|
||||||
|
|||||||
Binary file not shown.
@ -18,9 +18,9 @@ public class tk2dSpineboy : MonoBehaviour {
|
|||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
void Update() {
|
void Update() {
|
||||||
if(skeleton.loop) return;
|
if (skeleton.loop) return;
|
||||||
|
|
||||||
if(skeleton.state.Time >= skeleton.state.Animation.Duration - 0.25) {
|
if (skeleton.state.Animation != null && skeleton.state.Time >= skeleton.state.Animation.Duration - 0.25) {
|
||||||
skeleton.animationName = "walk";
|
skeleton.animationName = "walk";
|
||||||
skeleton.loop = true;
|
skeleton.loop = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,7 @@ public class SkeletonComponent : MonoBehaviour {
|
|||||||
if (attachment is RegionAttachment) {
|
if (attachment is RegionAttachment) {
|
||||||
RegionAttachment regionAttachment = (RegionAttachment)attachment;
|
RegionAttachment regionAttachment = (RegionAttachment)attachment;
|
||||||
|
|
||||||
regionAttachment.ComputeVertices(slot.Bone, vertexPositions);
|
regionAttachment.ComputeVertices(skeleton.X, skeleton.Y, slot.Bone, vertexPositions);
|
||||||
int vertexIndex = quadIndex * 4;
|
int vertexIndex = quadIndex * 4;
|
||||||
vertices[vertexIndex] = new Vector3(vertexPositions[RegionAttachment.X1], vertexPositions[RegionAttachment.Y1], 0);
|
vertices[vertexIndex] = new Vector3(vertexPositions[RegionAttachment.X1], vertexPositions[RegionAttachment.Y1], 0);
|
||||||
vertices[vertexIndex + 1] = new Vector3(vertexPositions[RegionAttachment.X4], vertexPositions[RegionAttachment.Y4], 0);
|
vertices[vertexIndex + 1] = new Vector3(vertexPositions[RegionAttachment.X4], vertexPositions[RegionAttachment.Y4], 0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user