本文整理汇总了C#中ICore.GetSiteVar方法的典型用法代码示例。如果您正苦于以下问题:C# ICore.GetSiteVar方法的具体用法?C# ICore.GetSiteVar怎么用?C# ICore.GetSiteVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICore
的用法示例。
在下文中一共展示了ICore.GetSiteVar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
//---------------------------------------------------------------------
public static void Initialize(ICore modelCore)
{
core = modelCore;
modelCore.Log.WriteLine("Inside Initialize method !!!");
ecoregions = modelCore.Landscape.NewSiteVar<IFireRegion>();
eventVar = modelCore.Landscape.NewSiteVar<Event>(InactiveSiteMode.DistinctValues);
timeOfLastFire = modelCore.Landscape.NewSiteVar<int>();
severity = modelCore.Landscape.NewSiteVar<byte>();
disturbed = modelCore.Landscape.NewSiteVar<bool>();
cohorts = modelCore.GetSiteVar<SiteCohorts>("Succession.Cohorts");
// Enable interactions with (almost) any fire extension:
modelCore.RegisterSiteVar(SiteVars.Severity, "Fire.Severity");
//Initialize TimeSinceLastFire to the maximum cohort age:
foreach (ActiveSite site in modelCore.Landscape)
{
// Test to make sure the cohort type is correct for this extension
if (site.Location.Row == 1 && site.Location.Column == 1 && !SiteVars.Cohorts[site].HasAge())
{
throw new System.ApplicationException("Error in the Scenario file: Incompatible extensions; Cohort age data required for this extension to operate.");
}
//UI.WriteLine("Inside foreach loop. Site R/C = {0}/{1} !!!", site.Location.Row, site.Location.Column);
ushort maxAge = Library.BaseCohorts.Util.GetMaxAge(cohorts[site]);
//ushort maxAge = Library.Cohort.AgeOnly.Util.GetMaxAge(SiteVars.Cohorts[site]);
//UI.WriteLine("Assigned maxAge");
timeOfLastFire[site] = modelCore.StartTime - maxAge;
}
}