@Test public void testGetAnimation_ShouldHaveEachDifferentKeyFrames_ForAnimationTypeA() { Animation<TextureRegion> animation = cache.getAnimation(ANIMATION_TYPE_A); TextureRegion frame = animation.getKeyFrame(0f); for (float time = 1f; time < 10f; time += 1f) { TextureRegion temporary = animation.getKeyFrame(time); assertThat(temporary).isNotEqualTo(frame); frame = temporary; } }
public Animation<TextureRegion> getAnimation(Object animationType) { Animation<TextureRegion> animation = animations.get(animationType); if (animation == null || hasDirectionChanged(animationType)) { TextureRegion[] regions = getRegionsForType(animationType); AnimationFrames frames = config.getFrames(animationType); animation = new Animation<TextureRegion>(frames.getDuration(), regions); animations.put(animationType, animation); directionMap.put(animationType, frames.getDirection()); } updateAnimation(animationType, animation); return animation; }
AnimationCache { public Animation<TextureRegion> getAnimation(Object animationType) { Animation<TextureRegion> animation = animations.get(animationType); if (animation == null || hasDirectionChanged(animationType)) { TextureRegion[] regions = getRegionsForType(animationType); AnimationFrames frames = config.getFrames(animationType); animation = new Animation<TextureRegion>(frames.getDuration(), regions); animations.put(animationType, animation); directionMap.put(animationType, frames.getDirection()); } updateAnimation(animationType, animation); return animation; } }
AnimationCache { public Animation<TextureRegion> getAnimation(Object animationType) { Animation<TextureRegion> animation = animations.get(animationType); if (animation == null || hasDirectionChanged(animationType)) { TextureRegion[] regions = getRegionsForType(animationType); AnimationFrames frames = config.getFrames(animationType); animation = new Animation<TextureRegion>(frames.getDuration(), regions); animations.put(animationType, animation); directionMap.put(animationType, frames.getDirection()); } updateAnimation(animationType, animation); return animation; } AnimationCache(AnimationSpriteSheet spriteSheet, AnimationConfig config); }
AnimationCache { public Animation<TextureRegion> getAnimation(Object animationType) { Animation<TextureRegion> animation = animations.get(animationType); if (animation == null || hasDirectionChanged(animationType)) { TextureRegion[] regions = getRegionsForType(animationType); AnimationFrames frames = config.getFrames(animationType); animation = new Animation<TextureRegion>(frames.getDuration(), regions); animations.put(animationType, animation); directionMap.put(animationType, frames.getDirection()); } updateAnimation(animationType, animation); return animation; } AnimationCache(AnimationSpriteSheet spriteSheet, AnimationConfig config); Animation<TextureRegion> getAnimation(Object animationType); }
AnimationCache { public Animation<TextureRegion> getAnimation(Object animationType) { Animation<TextureRegion> animation = animations.get(animationType); if (animation == null || hasDirectionChanged(animationType)) { TextureRegion[] regions = getRegionsForType(animationType); AnimationFrames frames = config.getFrames(animationType); animation = new Animation<TextureRegion>(frames.getDuration(), regions); animations.put(animationType, animation); directionMap.put(animationType, frames.getDirection()); } updateAnimation(animationType, animation); return animation; } AnimationCache(AnimationSpriteSheet spriteSheet, AnimationConfig config); Animation<TextureRegion> getAnimation(Object animationType);  }