private void HandleCellSpawns(Patch patch) { GD.Print("Number of species in this patch = ", patch.SpeciesInPatch.Count); foreach (var entry in patch.SpeciesInPatch) { var species = entry.Key; if (species.Population <= 0) { GD.Print(entry.Key.FormattedName, " population <= 0. Skipping Cell Spawn in patch."); continue; } var density = 1.0f / (Constants.STARTING_SPAWN_DENSITY - Math.Min(Constants.MAX_SPAWN_DENSITY, species.Population * 5)); var name = species.ID.ToString(CultureInfo.InvariantCulture); HandleSpawnHelper(chunkSpawners, name, density, () => { var spawner = new CreatedSpawner(name); spawner.Spawner = Spawners.MakeMicrobeSpawner(species, compoundCloudSystem, currentGame); spawnSystem.AddSpawnType(spawner.Spawner, density, Constants.MICROBE_SPAWN_RADIUS); return(spawner); }); } }
private void HandleCloudSpawns(BiomeConditions biome) { GD.Print("Number of clouds in this patch = ", biome.Compounds.Count); foreach (var entry in biome.Compounds) { HandleSpawnHelper(chunkSpawners, entry.Key.InternalName, entry.Value.Density, () => { var spawner = new CreatedSpawner(entry.Key.InternalName); spawner.Spawner = Spawners.MakeCompoundSpawner(entry.Key, compoundCloudSystem, entry.Value.Amount); spawnSystem.AddSpawnType(spawner.Spawner, entry.Value.Density, Constants.CLOUD_SPAWN_RADIUS); return(spawner); }); } }
private void HandleChunkSpawns(BiomeConditions biome) { GD.Print("Number of chunks in this patch = ", biome.Chunks.Count); foreach (var entry in biome.Chunks) { HandleSpawnHelper(chunkSpawners, entry.Value.Name, entry.Value.Density, () => { var spawner = new CreatedSpawner(entry.Value.Name); spawner.Spawner = Spawners.MakeChunkSpawner(entry.Value, compoundCloudSystem); spawnSystem.AddSpawnType(spawner.Spawner, (int)entry.Value.Density, Constants.MICROBE_SPAWN_RADIUS); return(spawner); }); } }