public bool IsEnemyAllowed(Enemy.EnemyTypes enemyType, double rarity = 1) { // spawn plane valid for diff? if (!ValidDiff()) { return(false); } // rarity // Easy - no rarity feature(no rare spawn), Nightmare - all included if (Config.GetInstance().Setting_Difficulty == Config.Difficulty.Easy) { rarity = 1; } else if (Config.GetInstance().Setting_Difficulty == Config.Difficulty.Nightmare) { rarity = 0; } if (this.rarity < rarity) { return(false); } // splitter? check if allowed if (enemyType == Enemy.EnemyTypes.Splitter) { return(SplitterAllowedToSpawn); } if (BannedTypes.Count == 0) { return(true); } return(!BannedTypes.Contains(enemyType)); }
// bans specific enemy type to spawn within all spawnplanes of this room public void BanRoomEnemyType(Enemy.EnemyTypes type) { for (int i = 0; i < spawnPlanes.Count; i++) { spawnPlanes[i].BanEnemyType(type); } }
// ban enemy type from using this spawnPlane public SpawnPlane BanEnemyType(Enemy.EnemyTypes enemyType) { if (BannedTypes.Contains(enemyType)) { return(this); } BannedTypes.Add(enemyType); return(this); }
public GameObject FindEnemyObjectOfType(Enemy.EnemyTypes enemyType) { foreach (EnemyType et in enemies) { if (et.enemyType == enemyType) { return(et.enemy); } } Debug.LogError("Could not find Enemy of type : " + enemyType.ToString() + ". Will spawn default enemy instead."); return(enemies[0].enemy); }