本文整理汇总了C#中GameObjects.PersonList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PersonList.Add方法的具体用法?C# PersonList.Add怎么用?C# PersonList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.PersonList
的用法示例。
在下文中一共展示了PersonList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CallInformation
internal void CallInformation()
{
if (!this.InformationDestination.HasValue)
{
PersonList list = new PersonList();
foreach (LinkNode node in this.WillArchitecture.AIAllLinkNodes.Values)
{
if ((((node.A.BelongedFaction == this.BelongedFaction) && node.A.BelongedSection != null &&
node.A.BelongedSection.AIDetail.AllowInvestigateTactics) && node.A.InformationAvail()) &&
(node.A.RecentlyAttacked <= 0))
{
foreach (Person person in node.A.Persons)
{
if (person.LocationArchitecture != null)
{
list.Add(person);
}
}
if (list.Count >= 10)
{
break;
}
}
}
if (list.Count > 0)
{
Person person = list[GameObject.Random(list.Count)] as Person;
InformationKindList availList = base.Scenario.GameCommonData.AllInformationKinds.GetAvailList(person.LocationArchitecture);
if (availList.Count > 0)
{
if (availList.Count > 1)
{
if (this.WillArchitecture.BelongedFaction == null)
{
availList.PropertyName = "CostFund";
availList.SmallToBig = true;
}
else
{
availList.PropertyName = "FightingWeighing";
}
availList.IsNumber = true;
availList.ReSort();
}
this.SetInformationPosition();
if (this.InformationDestination.HasValue)
{
person.CurrentInformationKind = availList[GameObject.Random(availList.Count / 2)] as InformationKind;
person.GoForInformation(this.InformationDestination.Value);
}
}
}
}
}
示例2: ReleaseCaptiveBeforeBeRouted
private void ReleaseCaptiveBeforeBeRouted()
{
if (this.HasCaptive())
{
PersonList personlist = new PersonList();
foreach (Captive captive in this.Captives.GetList())
{
if (captive.CaptivePerson != null && captive.CaptiveFaction != null && captive.CaptiveFaction.Capital != null)
{
personlist.Add(captive.CaptivePerson);
captive.CaptivePerson.SetBelongedCaptive(null, PersonStatus.Normal);
captive.CaptivePerson.LocationArchitecture = captive.CaptiveFaction.Capital;
captive.CaptivePerson.MoveToArchitecture(captive.CaptiveFaction.Capital);
}
ExtensionInterface.call("TroopReleaseCaptive", new Object[] { this.Scenario, this, captive });
}
if ((personlist.Count > 0) && (this.OnReleaseCaptive != null))
{
this.OnReleaseCaptive(this, personlist);
}
}
}
示例3: AIHouGong
private void AIHouGong()
{
if (base.Scenario.IsPlayer(this.BelongedFaction)) return;
if (this.HasHostileTroopsInView()) return;
if (GlobalVariables.getChildrenRate <= 0) return;
Person leader = this.BelongedFaction.Leader;
int uncruelty = leader.Uncruelty;
//build hougong
int unAmbition = Enum.GetNames(typeof(PersonAmbition)).Length - (int)leader.Ambition;
if (this.BelongedFaction.meinvkongjian() - this.BelongedFaction.feiziCount() <= 0 && (this.BuildingFacility < 0) && (this.PlanFacilityKind == null || this.PlanFacilityKind.rongna <= 0)
&& GameObject.Random((int)(GameObject.Square(unAmbition) * Parameters.AIBuildHougongUnambitionProbWeight + GameObject.Square(this.BelongedFaction.meinvkongjian()) * unAmbition * Parameters.AIBuildHougongSpaceBuiltProbWeight)) == 0)
{
if (((!this.FrontLine && !this.noFactionFrontline) || GameObject.Chance(Parameters.AILeaveFrontlineForHougongChance))
&& (!this.HostileLine || GameObject.Chance(Parameters.AILeaveHostilelineForHougongChance))
&& this.Kind.FacilityPositionUnit > 0 &&
this.Agriculture >= this.AgricultureCeiling * 9 / 10 && this.Commerce >= this.CommerceCeiling * 9 / 10 &&
this.Technology >= this.TechnologyCeiling * 9 / 10 && this.Endurance >= this.EnduranceCeiling * 9 / 10 &&
this.Domination >= this.DominationCeiling * 9 / 10 && this.Morale >= this.MoraleCeiling * 9 / 10)
{
int maxHgSize = (12 - uncruelty) + Math.Max(0, this.FacilityPositionCount / this.Kind.FacilityPositionUnit - 5) + Parameters.AIBuildHougongMaxSizeAdd;
FacilityKind hougong = null;
foreach (FacilityKind fk in base.Scenario.GameCommonData.AllFacilityKinds.FacilityKinds.Values)
{
if ((((!fk.PopulationRelated || this.Kind.HasPopulation) && ((this.Technology >= fk.TechnologyNeeded)))
&& ((!fk.UniqueInArchitecture || !this.ArchitectureHasFacilityKind(kind.ID)) && (!fk.UniqueInFaction || !this.FactionHasFacilityKind(kind.ID)))))
{
if (fk.rongna > 0 && fk.rongna < maxHgSize && GameObject.Chance(Parameters.AIBuildHougongSkipSizeChance))
{
if (hougong == null || hougong.rongna < fk.rongna)
{
hougong = fk;
}
}
}
}
if (hougong != null)
{
int facilityPositionLeft = this.FacilityPositionLeft;
if (facilityPositionLeft < hougong.PositionOccupied && this.FacilityPositionCount >= hougong.PositionOccupied)
{
FacilityList fl = new FacilityList();
foreach (Facility f in this.Facilities)
{
if (!f.Kind.bukechaichu)
{
fl.Add(f);
}
}
int totalRemovableSpace = 0;
foreach (Facility f in fl)
{
totalRemovableSpace += f.PositionOccupied;
}
if (totalRemovableSpace >= hougong.PositionOccupied && this.BelongedSection.AIDetail.AllowFacilityRemoval)
{
fl.PropertyName = "AIValue";
fl.IsNumber = true;
fl.SmallToBig = true;
fl.ReSort();
while (this.FacilityPositionLeft < hougong.PositionOccupied && fl.Count > 0)
{
Facility f = fl[0] as Facility;
if (this.FacilityEnabled || f.MaintenanceCost <= 0)
{
f.Influences.PurifyInfluence(this, Applier.Facility, f.ID);
}
this.Facilities.Remove(f);
base.Scenario.Facilities.Remove(f);
fl.Remove(f);
}
}
/*foreach (Facility facility in this.Facilities.GetList())
{
if ((((this.Technology > facility.TechnologyNeeded) && this.FacilityIsPossibleOverTechnology(facility.TechnologyNeeded))
&& ((this.Fund > (facility.FundCost * 10)) && (this.BelongedFaction.TechniquePoint > (facility.PointCost * 10))))
&& (GameObject.Random(facility.Days * facility.PositionOccupied) < 20 * hougong.PositionOccupied)
&& !facility.Kind.bukechaichu)
{
if (this.FacilityEnabled)
{
facility.Influences.PurifyInfluence(this);
}
this.Facilities.Remove(facility);
base.Scenario.Facilities.Remove(facility);
}
}*/
facilityPositionLeft = this.FacilityPositionLeft;
}
if (facilityPositionLeft >= hougong.PositionOccupied)
{
if ((this.Fund >= hougong.FundCost) && ((this.BelongedFaction.TechniquePoint + this.BelongedFaction.TechniquePointForFacility) >= hougong.PointCost))
{
this.PlanFacilityKind = null;
this.BelongedFaction.DepositTechniquePointForFacility(hougong.PointCost);
this.BeginToBuildAFacility(hougong);
}
//.........这里部分代码省略.........
示例4: meifaxianhuaiyundefeiziliebiao
public PersonList meifaxianhuaiyundefeiziliebiao()
{
PersonList meihuailiebiao = new PersonList();
foreach (Person person in this.Feiziliebiao)
{
if (!person.faxianhuaiyun && this.BelongedFaction.Leader.isLegalFeiZi(person))
meihuailiebiao.Add(person);
}
return meihuailiebiao;
}
示例5: yihuaiyundefeiziliebiao
public PersonList yihuaiyundefeiziliebiao()
{
PersonList feiziliebiao = new PersonList();
foreach (Person feizi in this.Feiziliebiao)
{
if (feizi.huaiyun)
{
feiziliebiao.Add(feizi);
}
}
return feiziliebiao;
}
示例6: GetConvinceDestinationPersonList
public PersonList GetConvinceDestinationPersonList(Faction faction)
{
PersonList result = new PersonList();
if (this.BelongedFaction == faction)
{
foreach (Captive captive in this.Captives)
{
result.Add(captive.CaptivePerson);
}
}
else
{
foreach (Person person in this.Persons)
{
result.Add(person);
}
}
foreach (Person person in this.NoFactionPersons)
{
result.Add(person);
}
ConvinceDestinationPersonList = result;
return result;
}
示例7: GetPersonListExceptLeader
public PersonList GetPersonListExceptLeader()
{
PersonList list = new PersonList();
if (this.BelongedFaction != null)
{
foreach (Person person in this.Persons)
{
if (person != this.BelongedFaction.Leader)
{
list.Add(person);
}
}
}
return list;
}
示例8: SelectSubOfficersToTroop
private PersonList SelectSubOfficersToTroop(Troop t)
{
int personCnt = 1;
PersonList result = new PersonList();
result.Add(t.Leader);
t.Leader.Selected = true;
GameObjectList candidates = this.Persons.GetList();
candidates.IsNumber = true;
candidates.PropertyName = "SubFightingForce";
candidates.SmallToBig = false;
candidates.ReSort();
foreach (Person person in candidates)
{
if ((!person.Selected && !t.Persons.HasGameObject(person)) && person.SubFightingForce > t.Leader.FightingForce
&& t.Leader.FightingForce > t.Leader.SubFightingForce && person.SubFightingForce > person.FightingForce)
{
person.Selected = true;
result.Add(person);
personCnt++;
if (personCnt >= 2) break;
}
else if (person.SubFightingForce <= t.Leader.FightingForce || t.Leader.FightingForce > t.Leader.SubFightingForce) break;
}
if (t.TroopIntelligence < 80)
{
foreach (Person person in candidates)
{
if (person.WaitForFeiZi != null) continue;
if ((!person.Selected && (person.Intelligence >= 80)) && (!t.Persons.HasGameObject(person) && ((((person.Strength < t.TroopStrength) && ((person.Intelligence - t.TroopIntelligence) >= 10)) && (person.FightingForce < t.Leader.FightingForce)) && !person.HasLeaderValidCombatTitle)))
{
person.Selected = true;
result.Add(person);
personCnt++;
break;
}
}
}
if (t.TroopStrength < 75)
{
foreach (Person person in candidates)
{
if (person.WaitForFeiZi != null) continue;
if ((!person.Selected && (person.Strength >= 75)) && ((!t.Persons.HasGameObject(person) && (person.ClosePersons.IndexOf(t.Leader.ID) >= 0)) && ((((person.Strength - t.TroopStrength) >= 10) && (person.FightingForce < t.Leader.FightingForce)) && !person.HasLeaderValidCombatTitle)))
{
person.Selected = true;
result.Add(person);
personCnt++;
break;
}
}
}
if (t.TroopCommand < 75)
{
foreach (Person person in candidates)
{
if (person.WaitForFeiZi != null) continue;
if ((!person.Selected && (person.Command >= 75)) && ((!t.Persons.HasGameObject(person) && (person.ClosePersons.IndexOf(t.Leader.ID) >= 0)) && ((((person.Command - t.TroopCommand) >= 10) && (person.FightingForce < t.Leader.FightingForce)) && !person.HasLeaderValidCombatTitle)))
{
person.Selected = true;
result.Add(person);
personCnt++;
break;
}
}
}
foreach (Person person in candidates)
{
if (person.WaitForFeiZi != null) continue;
if ((!person.Selected && !t.Persons.HasGameObject(person)) && ((person.FightingForce < t.Leader.FightingForce) && !person.HasLeaderValidCombatTitle))
{
int incrementPerDayOfCombativity = t.IncrementPerDayOfCombativity;
bool immunityOfCaptive = t.ImmunityOfCaptive;
int routIncrementOfCombativity = t.RoutIncrementOfCombativity;
int attackDecrementOfCombativity = t.AttackDecrementOfCombativity;
int count = t.CombatMethods.Count;
int chanceIncrementOfCriticalStrike = t.ChanceIncrementOfCriticalStrike;
int chanceDecrementOfCriticalStrike = t.ChanceDecrementOfCriticalStrike;
int chanceIncrementOfChaosAfterCriticalStrike = t.ChanceIncrementOfChaosAfterCriticalStrike;
int avoidSurroundedChance = t.AvoidSurroundedChance;
int chaosAfterSurroundAttackChance = t.ChaosAfterSurroundAttackChance;
int chanceIncrementOfStratagem = t.ChanceIncrementOfStratagem;
int chanceDecrementOfStratagem = t.ChanceDecrementOfStratagem;
int chanceIncrementOfChaosAfterStratagem = t.ChanceIncrementOfChaosAfterStratagem;
foreach (Skill s in person.Skills.GetSkillList())
{
s.Influences.PurifyInfluence(this, Applier.Skill, s.ID);
}
if (person.PersonalTitle != null)
{
person.PersonalTitle.Influences.PurifyInfluence(this, Applier.PersonalTitle, 0);
}
if (person.CombatTitle != null)
{
person.CombatTitle.Influences.PurifyInfluence(this, Applier.CombatTitle, 0);
}
person.ApplySkills();
person.ApplyTitles();
if (((((((t.IncrementPerDayOfCombativity > incrementPerDayOfCombativity) || (t.ImmunityOfCaptive != immunityOfCaptive)) || ((t.RoutIncrementOfCombativity > routIncrementOfCombativity) || (t.AttackDecrementOfCombativity > attackDecrementOfCombativity))) || ((t.CombatMethods.Count > count) || (((t.TroopStrength >= 70) && (t.ChanceIncrementOfCriticalStrike > chanceIncrementOfCriticalStrike)) && (t.ChanceIncrementOfCriticalStrike <= 50)))) || (((((t.TroopCommand >= 70) && (t.ChanceDecrementOfCriticalStrike > chanceDecrementOfCriticalStrike)) && (t.ChanceDecrementOfCriticalStrike <= 50)) || (((t.ChanceIncrementOfCriticalStrike >= 10) && (t.ChanceIncrementOfChaosAfterCriticalStrike > chanceIncrementOfChaosAfterCriticalStrike)) && (t.ChanceIncrementOfChaosAfterCriticalStrike <= 100))) || (((t.AvoidSurroundedChance <= 80) && (t.AvoidSurroundedChance > avoidSurroundedChance)) || ((t.ChaosAfterSurroundAttackChance <= 20) && (t.ChaosAfterSurroundAttackChance > chaosAfterSurroundAttackChance))))) || ((((t.TroopIntelligence >= 70) && (t.ChanceIncrementOfStratagem > chanceIncrementOfStratagem)) && (t.ChanceIncrementOfStratagem <= 30)) || (((t.TroopIntelligence >= 70) && (t.ChanceDecrementOfStratagem > chanceDecrementOfStratagem)) && (t.ChanceDecrementOfStratagem <= 30)))) || (((t.TroopIntelligence >= 0x55) && (t.ChanceIncrementOfChaosAfterStratagem > chanceIncrementOfChaosAfterStratagem)) && (t.ChanceIncrementOfChaosAfterStratagem <= 100)))
//.........这里部分代码省略.........
示例9: 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;
}
示例10: Enter
public void Enter(Architecture a)
{
if (a.BelongedFaction == this.BelongedFaction)
{
PersonList list = new PersonList();
foreach (Person person in this.Persons)
{
list.Add(person);
a.AddPerson(person);
}
this.Persons.ApplyInfluences();
foreach (Person person in list)
{
this.RemovePerson(person);
}
if (this.Army.ShelledMilitary == null)
{
a.AddMilitary(this.Army);
}
else
{
a.AddMilitary(this.Army.ShelledMilitary);
base.Scenario.Militaries.Remove(this.Army);
}
if (this.Food > 0)
{
a.IncreaseFood(this.Food);
}
this.MoveCaptiveIntoArchitecture(a);
this.Destroy();
this.BelongedLegion.RemoveTroop(this);
this.BelongedFaction.RemoveTroop(this);
base.Scenario.Troops.RemoveTroop(this);
}
}
示例11: ReleaseCaptiveBeforeBeRouted
private void ReleaseCaptiveBeforeBeRouted()
{
if (this.HasCaptive())
{
PersonList personlist = new PersonList();
foreach (Captive captive in this.Captives.GetList())
{
if (((captive.CaptivePerson != null) && (captive.CaptiveFaction != null)) && (captive.CaptiveFaction.Capital != null))
{
personlist.Add(captive.CaptivePerson);
captive.CaptivePerson.MoveToArchitecture(captive.CaptiveFaction.Capital);
captive.CaptivePerson.BelongedCaptive = null;
this.RemoveCaptive(captive);
this.BelongedFaction.RemoveCaptive(captive);
captive.CaptiveFaction.RemoveSelfCaptive(captive);
base.Scenario.Captives.Remove(captive);
}
}
if ((personlist.Count > 0) && (this.OnReleaseCaptive != null))
{
this.OnReleaseCaptive(this, personlist);
}
}
}
示例12: CheckCaptiveOnOccupy
private void CheckCaptiveOnOccupy(Architecture a)
{
if ((this.BelongedFaction != null) && (a.BelongedFaction != null))
{
PersonList personlist = new PersonList();
foreach (Person person in a.Persons)
{
if (!(person.ImmunityOfCaptive || (GameObject.Random(this.CaptiveAblility) <= GameObject.Random(person.CaptiveAbility + 200))))
{
personlist.Add(person);
}
}
if (personlist.Count > 0)
{
foreach (Person person in personlist)
{
a.RemovePerson(person);
Captive captive = Captive.Create(base.Scenario, person, this.BelongedFaction);
if (captive != null)
{
this.AddCaptive(captive);
}
}
if (this.OnGetNewCaptive != null)
{
this.OnGetNewCaptive(this, personlist);
}
}
}
}
示例13: CheckCaptiveBeforeRout
private void CheckCaptiveBeforeRout(Troop troop)
{
if ((((this.BelongedFaction != null) && (troop.BelongedFaction != null)) && !troop.ImmunityOfCaptive) && ((this.BelongedFaction != troop.BelongedFaction) && !troop.IsInArchitecture))
{
PersonList personlist = new PersonList();
foreach (Person person in troop.Persons)
{
if (!(person.ImmunityOfCaptive || (GameObject.Chance(person.ChanceOfNoCapture) || (GameObject.Random(this.CaptiveAblility) <= GameObject.Random(person.CaptiveAbility + 200)))))
{
personlist.Add(person);
}
}
if (personlist.Count > 0)
{
foreach (Person person in personlist)
{
troop.RemovePerson(person);
Captive captive = Captive.Create(base.Scenario, person, this.BelongedFaction);
if (captive != null)
{
this.AddCaptive(captive);
}
}
if (this.OnGetNewCaptive != null)
{
this.OnGetNewCaptive(this, personlist);
}
}
}
}
示例14: CallInstigate
private void CallInstigate()
{
if (this.WillArchitecture.Endurance >= (this.WillArchitecture.EnduranceCeiling * 0.2))
{
Person current;
PersonList list = new PersonList();
foreach (LinkNode node in this.WillArchitecture.AIAllLinkNodes.Values)
{
if ((((node.A.BelongedFaction == this.BelongedFaction) && (node.A.Fund >= node.A.InstigateArchitectureFund)) && node.A.BelongedSection.AIDetail.AllowOffensiveTactics) && (node.A.RecentlyAttacked <= 0))
{
//using (IEnumerator enumerator2 = node.A.Persons.GetEnumerator())
IEnumerator enumerator2 = node.A.Persons.GetEnumerator();
{
while (enumerator2.MoveNext())
{
current = (Person) enumerator2.Current;
list.Add(current);
}
}
if (list.Count >= 10)
{
break;
}
}
}
if (list.Count > 0)
{
if (list.Count > 1)
{
list.PropertyName = "InstigateAbility";
list.IsNumber = true;
list.ReSort();
}
current = list[GameObject.Random(list.Count / 2)] as Person;
if (GameObject.Chance(GameObject.Random(current.InstigateAbility - 150)) && (GameObject.Random(current.NonFightingNumber) > GameObject.Random(current.FightingNumber)))
{
current.GoForInstigate(this.WillArchitecture.Position);
}
}
}
}
示例15: CanKilledPersons
public PersonList CanKilledPersons()
{
PersonList personList = new PersonList();
foreach (Person person in this.Persons)
{
if (person.ID != this.BelongedFaction.LeaderID)
{
personList.Add(person);
}
}
return personList;
}