public MainThread() { rpgBot = new RPGBot(); lastTimeNanos = System.nanoTime(); managers = new ArrayList<Manager>(); setupManagers(); }
public void run() { while (true) { float timePassed = (System.nanoTime() - lastTimeNanos) / 10000000f; lastTimeNanos = System.nanoTime(); if (!rpgBot.isRunning) return; for (Manager m : managers) { m.update(timePassed); } try { Thread.sleep(50); } catch (Exception e) { e.printStackTrace(); } } }