From 08d5efa31d6813226c8706cd61fdd729885c8f45 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Thu, 3 Oct 2013 20:25:47 +0200 Subject: [PATCH] Simpler Spineboy.cs. --- spine-tk2d/Assets/examples/spineboy/Spineboy.cs | 16 +++------------- .../Assets/examples/spineboy/spineboy.json.txt | 15 +++++++++------ .../examples/spineboy/data/spineboy.json.txt | 5 +++++ 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/spine-tk2d/Assets/examples/spineboy/Spineboy.cs b/spine-tk2d/Assets/examples/spineboy/Spineboy.cs index 5f816ed66..5d9e37bca 100644 --- a/spine-tk2d/Assets/examples/spineboy/Spineboy.cs +++ b/spine-tk2d/Assets/examples/spineboy/Spineboy.cs @@ -41,7 +41,6 @@ public class Spineboy : MonoBehaviour { void Start() { skeleton = GetComponent(); - skeleton.state.Event += new EventHandler(Event); } @@ -49,18 +48,9 @@ public class Spineboy : MonoBehaviour { Debug.Log(e.TrackIndex + " " + skeleton.state.GetCurrent(e.TrackIndex) + ": event " + e.Event + ", " + e.Event.Int); } - void LateUpdate() { - if (skeleton.loop) return; - - TrackEntry entry = skeleton.state.GetCurrent(0); - if (entry != null && entry.Time >= entry.Animation.Duration - 0.25) { - skeleton.animationName = "walk"; - skeleton.loop = true; - } - } - void OnMouseDown() { - skeleton.animationName = "jump"; - skeleton.loop = false; + skeleton.useAnimationName = false; + skeleton.state.SetAnimation(0, "jump", false); + skeleton.state.AddAnimation(0, "walk", true, 0); } } diff --git a/spine-tk2d/Assets/examples/spineboy/spineboy.json.txt b/spine-tk2d/Assets/examples/spineboy/spineboy.json.txt index 2131b9fad..c2bfc6ccc 100644 --- a/spine-tk2d/Assets/examples/spineboy/spineboy.json.txt +++ b/spine-tk2d/Assets/examples/spineboy/spineboy.json.txt @@ -280,12 +280,10 @@ } }, "events": [ - { "time": 0.3333, "name": "headPop", "int": 1 }, - { "time": 0.5, "name": "headPop", "int": 2 }, - { "time": 0.6666, "name": "headPop", "int": 3 }, - { "time": 0.8333, "name": "headPop", "int": 4 }, - { "time": 1, "name": "headPop", "int": 5 }, - { "time": 1.1666, "name": "headPop", "int": 6 } + { "time": 0, "name": "headPop", "string": "pop.wav" }, + { "time": 1.3103, "name": "behind" }, + { "time": 2.9655, "name": "behind" }, + { "time": 4, "name": "headAttach", "string": "attach.wav" } ], "draworder": [ { @@ -997,6 +995,11 @@ { "time": 0.9333, "angle": 2.28 }, { "time": 1.0666, "angle": 3.6 } ] + }, + "root": { + "rotate": [ + { "time": 0, "angle": 0 } + ] } } } diff --git a/spine-unity/Assets/examples/spineboy/data/spineboy.json.txt b/spine-unity/Assets/examples/spineboy/data/spineboy.json.txt index 113e72c33..c2bfc6ccc 100644 --- a/spine-unity/Assets/examples/spineboy/data/spineboy.json.txt +++ b/spine-unity/Assets/examples/spineboy/data/spineboy.json.txt @@ -995,6 +995,11 @@ { "time": 0.9333, "angle": 2.28 }, { "time": 1.0666, "angle": 3.6 } ] + }, + "root": { + "rotate": [ + { "time": 0, "angle": 0 } + ] } } }