SpineboyComponent renamed to Spineboy.

This commit is contained in:
NathanSweet 2013-05-14 01:36:50 +02:00
parent a4bd912dc1
commit fbefc609a2
4 changed files with 25 additions and 56 deletions

View File

@ -27,6 +27,8 @@ package com.esotericsoftware.spine;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@ -56,6 +58,7 @@ public class AnimationStateTest extends ApplicationAdapter {
AnimationStateData stateData = new AnimationStateData(skeletonData);
stateData.setMix("walk", "jump", 0.2f);
stateData.setMix("jump", "walk", 0.4f);
stateData.setMix("jump", "jump", 0.2f);
state = new AnimationState(stateData);
state.setAnimation("walk", true);
@ -67,6 +70,19 @@ public class AnimationStateTest extends ApplicationAdapter {
root.setY(20);
skeleton.updateWorldTransform();
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean touchDown (int screenX, int screenY, int pointer, int button) {
keyDown(0);
return true;
}
public boolean keyDown (int keycode) {
state.setAnimation("jump", false);
state.addAnimation("walk", true);
return true;
}
});
}
public void render () {

View File

@ -99,13 +99,16 @@ public class SkeletonTest extends ApplicationAdapter {
skeleton.updateWorldTransform();
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean touchDown (int screenX, int screenY, int pointer, int button) {
keyDown(0);
return true;
}
public boolean keyDown (int keycode) {
if (keycode == Keys.SPACE) {
if (name.equals("goblins")) {
skeleton.setSkin(skeleton.getSkin().getName().equals("goblin") ? "goblingirl" : "goblin");
skeleton.setSlotsToSetupPose();
}
}
return true;
}
});
@ -122,7 +125,7 @@ public class SkeletonTest extends ApplicationAdapter {
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
animation.apply(skeleton, time, true);
animation.apply(skeleton, time, false);
skeleton.updateWorldTransform();
skeleton.update(Gdx.graphics.getDeltaTime());

View File

@ -1,43 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
using UnityEngine;
using System.Collections;
public class SpineboyComponent : MonoBehaviour {
public void OnMouseDown () {
SkeletonComponent skeletonComponent = GetComponent<SkeletonComponent>();
skeletonComponent.animationName = "jump";
skeletonComponent.loop = false;
}
public void Update () {
SkeletonComponent skeletonComponent = GetComponent<SkeletonComponent>();
if (!skeletonComponent.loop && skeletonComponent.state.Time >= skeletonComponent.state.Animation.Duration - 0.25) {
skeletonComponent.animationName = "walk";
skeletonComponent.loop = true;
}
}
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 1f998efe00dbbc246afece8f6a849fc6
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}