本文整理汇总了C#中GameObjects.PersonList.GetRandomList方法的典型用法代码示例。如果您正苦于以下问题:C# PersonList.GetRandomList方法的具体用法?C# PersonList.GetRandomList怎么用?C# PersonList.GetRandomList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.PersonList
的用法示例。
在下文中一共展示了PersonList.GetRandomList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HireNoFactionPerson
public void HireNoFactionPerson()
{
PersonList personList = new PersonList();
PersonList recruitablePeople = new PersonList();
foreach (Person person in this.NoFactionPersons.GetList())
{
if ((person.BelongedFaction != null) || (person.LocationArchitecture != this))
{
//this.RemoveNoFactionPerson(person);
}
else
{
int idealOffset = Person.GetIdealOffset(person, this.BelongedFaction.Leader);
if (
((!GlobalVariables.IdealTendencyValid || (idealOffset <= person.IdealTendency.Offset + (double)this.BelongedFaction.Reputation / this.BelongedFaction.MaxPossibleReputation * 75))
&& (!this.BelongedFaction.IsAlien || (int)person.PersonalLoyalty < 2)
&& (!person.HatedPersons.Contains(this.BelongedFaction.LeaderID)))
|| (!base.Scenario.IsPlayer(this.BelongedFaction) && GlobalVariables.AIAutoTakeNoFactionPerson)
)
{
recruitablePeople.Add(person);
}
}
}
if (recruitablePeople.Count > 0)
{
foreach (Person toRecruit in recruitablePeople.GetRandomList())
{
this.DecreaseFund(this.HirePersonFund);
if (!((toRecruit.BelongedFaction != null) || (toRecruit.LocationArchitecture != this)))
{
int idealOffset = Person.GetIdealOffset(toRecruit, this.BelongedFaction.Leader);
if (
((!GlobalVariables.IdealTendencyValid || (idealOffset <= toRecruit.IdealTendency.Offset + (double)this.BelongedFaction.Reputation / this.BelongedFaction.MaxPossibleReputation * 75))
&& (GameObject.Random(idealOffset * idealOffset + 100) < 100)
&& (!this.BelongedFaction.IsAlien || (int)toRecruit.PersonalLoyalty < 2)
&& (!toRecruit.HatedPersons.Contains(this.BelongedFaction.LeaderID)))
|| (!base.Scenario.IsPlayer(this.BelongedFaction) && GlobalVariables.AIAutoTakeNoFactionPerson)
)
{
if (toRecruit.ProhibitedFactionID != this.BelongedFaction.ID)
{
personList.Add(toRecruit);
}
}
}
if (this.Fund < this.HirePersonFund)
{
break;
}
/*if (GameObject.Random(recruitablePeople.Count) < 0)
{
break;
}*/
}
}
foreach (Person person in personList)
{
person.ChangeFaction(this.BelongedFaction);
ExtensionInterface.call("HirePerson", new Object[] { this.Scenario, this, person });
this.Scenario.GameScreen.xianshishijiantupian(person, this.Name, "ArchitectureHirePerson", "", "", this.BelongedFaction.Name, false);
}
if (personList.Count > 0)
{
/*
if (this.OnHirePerson != null)
{
this.OnHirePerson(personList);
}
*/
if (this.HasSpy)
{
this.CreateHireNewPersonSpyMessage(personList[GameObject.Random(personList.Count)] as Person);
}
}
else if (personList.Count == 0)
{
if ((this.Scenario.CurrentPlayer != null) && this.BelongedFaction == this.Scenario.CurrentPlayer)
{
//this.shoudongluyongshibai = true;
}
}
this.HireFinished = true;
}