public void tick() {
        currentTime += frameRate;
        subtractCountdownToNextWave(frameRate);

        if (!gameover) {
            notifyListeners();

            if (countdownToNextWave <= DELTA) {

                // asume all enemies are dead and if this is not the case it is set to false below.
                boolean allEnemiesAreDead = true;
                for (Enemy currentEnemy : allEnemiesInCurrentWave) {
                    currentEnemy.tick(currentTime);
                    if (currentEnemy.isAlive()) {
                        allEnemiesAreDead = false;
                    }
                }
                if (allEnemiesAreDead) {
                    if(enemyWaves.isThereMoreGroups()) {
                        setCountdownToNextWave(enemyWaves.getNextGroupsActivationTime());
                        allEnemiesInCurrentWave = enemyWaves.getNextEnemyWave();
                        currentTime = 0;
                    } else {
                        playerWins();
                        notifyListeners();
                    }

                }
                if (player.getLives() <= 0) {
                    gameOver();
                }
                for ( Tower currentTower : allTowers) {
                    currentTower.tick(allEnemiesInCurrentWave);
                }
            }
        }
    }