示例#1
0
 public void act() {
   mCount++;
   if (getLifeCycle() == State.Dive) setY((short) (incrementY() + y()));
   else if (getLifeCycle() == State.Dead) {
     checkRemove();
   }
   super.act();
 }
示例#2
0
  public void tick() {
    for (Class<? extends Actor> cls : actOrder)
      for (Actor actor : getActors(cls)) {
        if (!actor.expired() && !actor.getClass().equals(Player.class)) {
          actor.act();
        }
      }

    removeExpired();
  }
  public void step() {
    Grid<Actor> gr = getGrid();
    ArrayList<Actor> actors = new ArrayList<Actor>();
    for (Location loc : gr.getOccupiedLocations()) actors.add(gr.get(loc));

    for (Actor a : actors) {
      // only act if another actor hasn't removed a
      if (a.getGrid() == gr) a.act();
    }
  }
示例#4
0
 public void act() {
   super.act();
   y += vy;
   x += vx;
   if (y < 0 || y > Stage.HEIGHT || x < 0 || x > Stage.WIDTH) remove();
 }
示例#5
0
 public void performPlay() {
   actor.act();
 }
示例#6
0
 @Test
 public void testAct() {
   Actor actorObject = new Actor();
   Assert.assertEquals(actorObject.act("Chiranjeevi"), "Chiranjeevi is acting...");
   Assert.assertEquals(actorObject.act("Nagarjuna"), "Nagarjuna is acting...");
 }
示例#7
0
 public void act() {
   super.act();
   y -= BULLET_SPEED;
   if (y < 0) remove();
 }
 /** Take a single step of the simulation. */
 public void step() {
   for (Actor actor : actors) {
     actor.act();
   }
 }