public void AttemptSpawn(Vector3 samplePoint, TerrainObjectType terrainObjectSettings, bool randomAge, bool checkSurroundings) { float viability = terrainObjectSettings.TestViability(ref samplePoint, checkSurroundings); if (viability <= terrainObjectSettings.viabilitySettings.minViability) { return; } float viabilityPercentage = CustomMathf.RemapValue(viability, terrainObjectSettings.viabilitySettings.minViability, 1f, true); float num = !randomAge ? 0.0f : initialAgeDistribution.GetValue(Random.value) * terrainObjectSettings.dna.lifetime.minOutputValue * LevelController.Instance.yearLength; var newObject = terrainObjectSettings.SpawnFoliageObject(samplePoint, Time.time - num, viabilityPercentage, reproduceAnnually); if (newObject.GetType() == typeof(FoliageObject)) { AddFoliageObject((FoliageObject)newObject); } else { AddTerrainObject(newObject); } }
public void AttemptSpawn (Vector3 samplePoint, TerrainObjectType terrainObjectSettings, bool randomAge, bool checkSurroundings) { float viability = terrainObjectSettings.TestViability(ref samplePoint, checkSurroundings); if (viability <= terrainObjectSettings.viabilitySettings.minViability) { return; } float viabilityPercentage = CustomMathf.RemapValue(viability, terrainObjectSettings.viabilitySettings.minViability, 1f, true); float num = !randomAge ? 0.0f : initialAgeDistribution.GetValue(Random.value) * terrainObjectSettings.dna.lifetime.minOutputValue * LevelController.Instance.yearLength; var newObject = terrainObjectSettings.SpawnFoliageObject(samplePoint, Time.time - num, viabilityPercentage, reproduceAnnually); if (newObject.GetType() == typeof(FoliageObject)) { AddFoliageObject((FoliageObject)newObject); } else { AddTerrainObject(newObject); } }