浏览代码

Fixed AnimationState bug.

NathanSweet 12 年之前
父节点
当前提交
7d7e56bb24

+ 3 - 1
spine-c/src/spine/AnimationState.c

@@ -78,13 +78,15 @@ void AnimationState_setAnimation (AnimationState* self, Animation* newAnimation,
 		if (internal->mixDuration > 0) {
 			internal->mixTime = 0;
 			internal->previous = self->animation;
+			internal->previousTime = self->time;
+			internal->previousLoop = self->loop;
 		}
 	}
 	CONST_CAST(Animation*, self->animation) = newAnimation;
 	self->loop = loop;
 	self->time = 0;
 }
-
+    
 #ifdef __cplusplus
 }
 #endif

+ 5 - 8
spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java

@@ -60,25 +60,22 @@ public class AnimationState {
 			current.apply(skeleton, currentTime, currentLoop);
 	}
 
-	/** Set the current animation. */
+	/** Set the current animation. The current animation time is set to 0.
+	 * @param animation May be null. */
 	public void setAnimation (Animation animation, boolean loop) {
-		setAnimation(animation, loop, 0);
-	}
-
-	/** Set the current animation.
-	 * @param time The time within the animation to start. */
-	public void setAnimation (Animation animation, boolean loop, float time) {
 		previous = null;
 		if (animation != null && current != null) {
 			mixDuration = data.getMix(current, animation);
 			if (mixDuration > 0) {
 				mixTime = 0;
 				previous = current;
+				previousTime = currentTime;
+				previousLoop = currentLoop;
 			}
 		}
 		current = animation;
 		currentLoop = loop;
-		currentTime = time;
+		currentTime = 0;
 	}
 
 	/** @return May be null. */