当前位置: 首页>>代码示例>>C#>>正文


C# PersonList.GetRandomList方法代码示例

本文整理汇总了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;
        }
开发者ID:kanjianlema,项目名称:ZhongHuaSanGuoZhi,代码行数:85,代码来源:Architecture.cs


注:本文中的GameObjects.PersonList.GetRandomList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。