void OnEnable() { if (infoDisplay != null) { infoDisplay.DisplayScore(PlayerController.PlayerScore); } }
// FixedUpdate is called once per physics frame void FixedUpdate() { foreach (var entry in activeEnemies) { GameObject enemy = entry.Key; if (!enemy.activeSelf) { int points = (int)entry.Value; PlayerController.PlayerScore += points; infoDisplay.DisplayScore(PlayerController.PlayerScore); activeEnemies.Remove(enemy); Destroy(enemy.gameObject); } } if (activeEnemies.Count == 0) { StartNextWave(); } }