Пример #1
0
 public void clearCommands() {
   for (Iterator<Command> it = commands.iterator(); it.hasNext(); ) {
     Command command = it.next();
     command.setRunning(false);
   }
   commands.clear();
 }
Пример #2
0
 public void addCommand(Command command) {
   command.setRunning(true);
   for (int i = 0; i < commands.size(); i++) {
     Command command1 = commands.get(i);
     if (command1.getPriority() < command.getPriority()) {
       commands.add(i, command);
       return;
     }
   }
   commands.add(command);
 }
Пример #3
0
 public void update(float tpf) {
   if (!enabled) {
     return;
   }
   for (Iterator<Command> it = commands.iterator(); it.hasNext(); ) {
     Command command = it.next();
     // do command and remove if returned true, else stop processing
     Command.State commandState = command.doCommand(tpf);
     switch (commandState) {
       case Finished:
         command.setRunning(false);
         it.remove();
         break;
       case Blocking:
         return;
       case Continuing:
         break;
     }
   }
 }
Пример #4
0
 public void removeCommand(Command command) {
   command.setRunning(false);
   commands.remove(command);
 }
Пример #5
0
 public Command initializeCommand(Command command) {
   return command.initialize(world, playerId, entityId, spatial);
 }