Exemplo n.º 1
0
  public MainThread() {

    rpgBot = new RPGBot();
    lastTimeNanos = System.nanoTime();
    managers = new ArrayList<Manager>();
    setupManagers();
  }
Exemplo n.º 2
0
  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();
      }
    }
  }