private void EnemyKilled(int val, BaseUnit enemy) { --numOfEnemies; enemies.Remove(enemy); playerModel.AddTime(enemy); goldAmount += UnityEngine.Random.Range(1, 2 * playerModel.GetDifficulty()); if (enemies.Count == 1 && spawnRemaining <= 0) { OneRemainingEnemy(); } else if (enemies.Count <= 0) { if (this != null) { StartCoroutine(WaveCompleted()); } } }