public void process() { if (action != null) { if (player.isDead()) { forceStop(); } else if (!action.process(player)) { forceStop(); } } if (actionDelay > 0) { actionDelay--; return; } if (action == null) return; int delay = action.processWithDelay(player); if (delay == -1) { forceStop(); return; } actionDelay += delay; }
public void forceStop() { if (action == null) return; action.stop(player); action = null; }
public boolean setSkill(Action skill) { forceStop(); if (!skill.start(player)) return false; this.action = skill; return true; }