示例#1
0
  @Test
  public void picksFuel() {
    // jogador apanha um bonus de combustivel
    Player p = new Player(true);

    int fuel = p.getFuel();

    // cria objeto que da a vida ao player
    Fuel f = new Fuel(p.getX(), p.getY(), true);

    // verifica se apanha
    assertTrue(f.colide(p));
    f.caught(p, true);

    // nao ganha fuel, pois esta cheio
    assertFalse(fuel < p.getFuel());

    // retirar fuel
    p.addFuel(-100);
    assertTrue(fuel > p.getFuel());

    // ganha fuel
    int fuel1 = p.getFuel();
    f.caught(p, true);
    assertTrue(fuel1 < p.getFuel());
  }
示例#2
0
 public void Load(byte[] buffer) {
   ByteArrayInputStream stream = new ByteArrayInputStream(buffer);
   tach.Load(stream);
   speedo.Load(stream);
   odo.Load(stream);
   fuel.Load(stream);
 }