@Test public void testUpdate() { World world = new World(); System.out.println("update()"); Currency c = new Currency.Builder(world) .build(); Generator g = new Generator.Builder(world) .generate(c) .build(); g.upgrade(); Automator a = new Automator.Builder(world) .automate(g) .every(1.0) .build(); a.upgrade(); world.update(1.0); assertEquals(1, g.getTimesProcessed()); world.update(9.0); assertEquals(10, g.getTimesProcessed()); }
void update(double delta) { if (!enabled || itemLevel == 0) return; tickTimer += delta; while (tickTimer >= actualTickRate) { tickTimer -= actualTickRate; generator.process(); } }
Automator extends Item implements Serializable { void update(double delta) { if (!enabled || itemLevel == 0) return; tickTimer += delta; while (tickTimer >= actualTickRate) { tickTimer -= actualTickRate; generator.process(); } } }
Automator extends Item implements Serializable { void update(double delta) { if (!enabled || itemLevel == 0) return; tickTimer += delta; while (tickTimer >= actualTickRate) { tickTimer -= actualTickRate; generator.process(); } } private  Automator(World world, String name); }
Automator extends Item implements Serializable { void update(double delta) { if (!enabled || itemLevel == 0) return; tickTimer += delta; while (tickTimer >= actualTickRate) { tickTimer -= actualTickRate; generator.process(); } } private  Automator(World world, String name); void enable(); void disable(); @Override void upgrade(); double getTickRate(); void setTickRate(double tickRate); double getTimerPercentage(); }
Automator extends Item implements Serializable { void update(double delta) { if (!enabled || itemLevel == 0) return; tickTimer += delta; while (tickTimer >= actualTickRate) { tickTimer -= actualTickRate; generator.process(); } } private  Automator(World world, String name); void enable(); void disable(); @Override void upgrade(); double getTickRate(); void setTickRate(double tickRate); double getTimerPercentage();  }