process method

void process({
  1. Duration delta = const Duration(milliseconds: 16),
})

Implementation

void process({Duration delta = const Duration(milliseconds: 16)}) {
  _entityManager.processCreationQueue();

  for (var system in _systems) {
    if (stats != null) {
      final systemStats =
          stats!.getOrCreateSystemStats(system.name);
      final stopwatch = Stopwatch()..start();
      final entitiesBefore = _entityManager.entities.length;

      system.process(delta);

      stopwatch.stop();
      systemStats.recordExecution(stopwatch.elapsed, entitiesBefore);
    } else {
      system.process(delta);
    }

    _entityManager.processDeletionQueue();
  }

  _worldTime += delta;
  _frameCount++;

  if (stats != null) {
    _entityManager.updateArchetypeStats();
    stats!.setFrameCount(_frameCount);
    stats!.setWorldTime(_worldTime);
  }
}