private static final Logger log = Logger.getLogger(AnimationSystemTest.class.getName());
private String currentAnim = "";
public void testSelf() throws MalformedURLException{
Mediator mediator = new Mediator(getActions(), new Transitions(new String[][]{}));
InputProvider in = new InputProvider();
mediator.setAnimationProvider(this);
mediator.update(0.5f);
log.info("Animation name:"+currentAnim);
assertTrue(currentAnim.startsWith("stand_"));
mediator.update(10.0f);
in.setInput(Direction.Front);
in.setInput(Speed.Run);
mediator.update(10.0f);
//should still be stand, one frame coherence
assertTrue(currentAnim.startsWith("stand_"));
log.info("Animation name:"+currentAnim);
mediator.setInput(in);
mediator.update(10.0f);
//now changed
log.info("Animation name:"+currentAnim);
assertTrue(currentAnim.startsWith("run"));
mediator.update(10.0f);
log.info("Animation name:"+currentAnim);
assertTrue(currentAnim.startsWith("run"));
in = new InputProvider();
in.setInput(Direction.None);
in.setInput(Speed.Run);//implizit overrule of speed (no direction, no speed)
mediator.setInput(in);
mediator.update(10.0f);
//back to idle?
assertTrue(currentAnim.startsWith("stand_"));
in = new InputProvider();
in.setInput(Enemy.Near);
mediator.setInput(in);
mediator.update(10.0f);
//now changed
log.info("Animation name:"+currentAnim);
assertTrue(currentAnim.startsWith("ready"));
mediator.update(10.0f);
mediator.update(10.0f);
in = new InputProvider();
in.setInput(HurtVector.Front);
in.setInput(Hurt.Light);
mediator.callAction("Wounded", in);
mediator.update(10f);
log.info("Animation name:"+currentAnim);
assertTrue(currentAnim.startsWith("knockback"));