コード例 #1
0
ファイル: Arena.java プロジェクト: pokus001/vivae
 /** Sets up new coordinates and rotation of all VivaeObjects according to their movement. */
 public void moveVivaes() {
   //        for (Active active : actives) {
   //            active.moveComponent();
   //        }
   for (Passive passive : passives) {
     passive.moveComponent();
   }
   for (VivaeController controller : controllers) {
     controller.moveControlledObject();
   }
 }
コード例 #2
0
ファイル: Arena.java プロジェクト: jakubplichta/vivae
 /**
  * Registers a controller to an Active object. If the controller extends KeyboardVivaeController
  * it also registers it to the parent component as a new KeyListener.
  *
  * @param agent The Active the controller will control.
  * @param controller The controller specifing behavior of the Active object.
  */
 public void registerController(Active agent, VivaeController controller) {
   controller.setControlledObject(agent);
   controllers.add(controller);
   if (agent instanceof Robot && controller instanceof KeyboardVivaeController) {
     if (parent != null) parent.addKeyListener((KeyboardVivaeController) controller);
     this.addKeyListener((KeyboardVivaeController) controller);
   }
 }
コード例 #3
0
ファイル: Arena.java プロジェクト: pokus001/vivae
 /**
  * Registers a controller to an Active object. If the controller extends KeyboardVivaeController
  * it also registers it to the parent component as a new KeyListener.
  *
  * @param agent The Active the controller will control.
  * @param controller The controller specifing behavior of the Active object.
  */
 public void registerController(IRobotInterface agent, VivaeController controller) {
   controller.setControlledObject(agent);
   controllers.add(controller);
   if (agent instanceof VivaeRobotRepresent && controller instanceof KeyboardVivaeController) {
     if (parent != null) {
       parent.addKeyListener((KeyboardVivaeController) controller);
     }
     this.addKeyListener((KeyboardVivaeController) controller);
   }
 }