notifyListeners method

void notifyListeners()

Implementation

void notifyListeners() {
  if (!hasGameRef) return;
  bool notifyChangeEnemy = false;
  int countLive = livingEnemies?.length ?? 0;

  if (_lastCountLiveEnemies != countLive) {
    _lastCountLiveEnemies = countLive;
    notifyChangeEnemy = true;
  }
  if (_gameListeners.isNotEmpty) {
    _gameListeners.forEach((element) {
      element.updateGame();
      if (notifyChangeEnemy) {
        element.changeCountLiveEnemies(_lastCountLiveEnemies);
      }
    });
  }
}