本文整理汇总了C#中GameObjects.ArchitectureList.GetRandomObject方法的典型用法代码示例。如果您正苦于以下问题:C# ArchitectureList.GetRandomObject方法的具体用法?C# ArchitectureList.GetRandomObject怎么用?C# ArchitectureList.GetRandomObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.ArchitectureList
的用法示例。
在下文中一共展示了ArchitectureList.GetRandomObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: generatePerson
private void generatePerson()
{
this.scen.GameCommonData.PersonGeneratorSetting.bornLo = int.Parse(tbBornYearLo.Text);
this.scen.GameCommonData.PersonGeneratorSetting.bornHi = int.Parse(tbBornYearHi.Text);
this.scen.GameCommonData.PersonGeneratorSetting.debutLo = int.Parse(tbDebutAgeLo.Text);
this.scen.GameCommonData.PersonGeneratorSetting.debutHi = int.Parse(tbDebutAgeHi.Text);
this.scen.GameCommonData.PersonGeneratorSetting.dieLo = int.Parse(tbAgeLo.Text);
this.scen.GameCommonData.PersonGeneratorSetting.dieHi = int.Parse(tbAgeHi.Text);
this.scen.GameCommonData.PersonGeneratorSetting.debutAtLeast = int.Parse(tbDebutAtLeast.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[0]).generationChance = int.Parse(tbPersonType0.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[1]).generationChance = int.Parse(tbPersonType1.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[2]).generationChance = int.Parse(tbPersonType2.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[3]).generationChance = int.Parse(tbPersonType3.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[4]).generationChance = int.Parse(tbPersonType4.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[5]).generationChance = int.Parse(tbPersonType5.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[6]).generationChance = int.Parse(tbPersonType6.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[7]).generationChance = int.Parse(tbPersonType7.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[8]).generationChance = int.Parse(tbPersonType8.Text);
((PersonGeneratorType)this.scen.GameCommonData.AllPersonGeneratorTypes.GameObjects[9]).generationChance = int.Parse(tbPersonType9.Text);
int count = GameObject.Random(int.Parse(tbAddPersonLo.Text), int.Parse(tbAddPersonHi.Text));
int joinChance = int.Parse(tbJoinedFactionChance.Text);
for (int i = 0; i < count; ++i)
{
bool joined = GameObject.Chance(joinChance);
Architecture location = null;
if (joined)
{
ArchitectureList candidates = new ArchitectureList();
foreach (Architecture j in scen.Architectures)
{
if (j.BelongedFaction != null)
{
candidates.Add(j);
}
}
if (candidates.Count > 0)
{
location = (Architecture)candidates.GetRandomObject();
}
else
{
joined = false;
}
}
if (!joined)
{
location = (Architecture)scen.Architectures.GetRandomObject();
}
Person p = Person.createPerson(scen, location, null, false);
if (joined && location.BelongedFaction != null)
{
p.ChangeFaction(location.BelongedFaction);
}
}
}