コード例 #1
0
		//---------------------------------------------------------------------

		/// <summary>
		/// Determines if a species resprouts when one of its cohorts dies.
		/// </summary>
		public static bool Resprout(AgeOnly.ICohort cohort,
		                            ActiveSite      site)
		{
			ISpecies species = cohort.Species;
			return (species.MinSproutAge <= cohort.Age) &&
			       (cohort.Age <= species.MaxSproutAge) &&
				   SufficientLight(species, site) &&
				   Establish(species, site);
		}
コード例 #2
0
		//---------------------------------------------------------------------

		private bool DamageCohort(AgeOnly.ICohort cohort)
		{
			float ageAsPercent = cohort.Age / (float) cohort.Species.Longevity;
			for (int i = 0; i < severities.Length; ++i) {
				ISeverity severity = severities[i];
				if (severity.AgeRange.Contains(ageAsPercent)) {
					if (intensity < severity.MortalityProbability) {
						cohortsKilled++;
						if (severity.Number > siteSeverity)
							siteSeverity = severity.Number;
						logger.Debug(string.Format("  cohort {0}:{1} killed, severity {2}", cohort.Species.Name, cohort.Age, severity.Number));
						return true;
					}
					break;  // No need to search further in the table
				}
			}
			return false;
		}