public void AddEnemy(IEnemy enemy) { int number = GameManager.Instance.GetGameLevel().Number; if (enemy.TypeId == (int)GameObjectType.Portal) { enemy.IsBonus = number < 3 || (Random.Range(0, 19 + number) >= 7 + number); var portal = enemy as Portal; portal.OnEnemyCreated += OnEnemyCreated; } else if (enemy.TypeId == (int)GameObjectType.Beetle) { enemy.IsBonus = number < 3 || (Random.Range(0, 19 + number) >= 7 + number); var beetle = enemy as Beetle; beetle.OnEnemyCreated += OnEnemyCreated; } else { /*int r = Random.Range(0, 39 + number); * DebugLogger.WriteInfo("EnemyManager.AddEnemy enemy.Id = {0}; r = {1}", * enemy.Id, r);*/ enemy.IsBonus = (Random.Range(0, 39 + number) >= 23 + number); } //DebugLogger.WriteInfo("EnemyManager.AddEnemy enemy.Id = {0}; enemy.IsBonus = {1}; number = {2}", // enemy.Id, enemy.IsBonus ? 1 : 0, number); _enemyList.Add(enemy); _enemyIdList.Add(enemy.Id); enemy.AddObserver(_DiedObject); if (OnEnemyAdded != null) { OnEnemyAdded(); } }