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


C# Role.EndRole方法代码示例

本文整理汇总了C#中Role.EndRole方法的典型用法代码示例。如果您正苦于以下问题:C# Role.EndRole方法的具体用法?C# Role.EndRole怎么用?C# Role.EndRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Role的用法示例。


在下文中一共展示了Role.EndRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SimulateRole

        public static void SimulateRole(Role ths, float minPassed)
        {
            if (!Register.Settings.mAllowTourists)
            {
                ths.EndRole();
                return;
            }

            if (ths.IsActive)
            {
                List<Lot> baseCamps = new List<Lot>();

                foreach (Lot lot in LotManager.AllLots)
                {
                    if ((lot.IsBaseCampLotType) || (lot.CommercialLotSubType == CommercialLotSubType.kEP10_Resort))
                    {
                        baseCamps.Add(lot);
                    }
                }

                // Drop the EndRole alarm
                foreach (AlarmHandle handle in ths.mAlarmHandles)
                {
                    AlarmManager.Global.RemoveAlarm(handle);
                }

                ths.mAlarmHandles.Clear();

                if (baseCamps.Count > 0)
                {
                    Sim createdSim = ths.mSim != null ? ths.mSim.CreatedSim : null;
                    if (createdSim != null)
                    {
                        if (ths.mMinInLot >= RoleExplorer.kMinPassToAllowSwitchingLots)
                        {
                            if (SimClock.IsTimeBetweenTimes((float)SimClock.Hours24, RoleExplorer.kTimeToGoBackToBaseCamp, RoleExplorer.kTimeToReleaseFromBaseCamp) && (!createdSim.LotCurrent.IsBaseCampLotType))
                            {
                                if (RandomUtil.RandomChance(Register.Settings.mTouristChanceOfLeaving))
                                {
                                    RestoreFutureTrait(ths.mSim);

                                    ths.EndRole();
                                    return;
                                }
                            }

                            if (RandomUtil.CoinFlip())
                            {
                                if (!createdSim.InteractionQueue.Add(GoToLotThatSatisfiesMyRoleEx.Singleton.CreateInstance(createdSim, createdSim, new InteractionPriority(InteractionPriorityLevel.High), true, true)))
                                {
                                    Lot baseCamp = RandomUtil.GetRandomObjectFromList(baseCamps);

                                    createdSim.InteractionQueue.CancelAllInteractions();
                                    InteractionInstance instance = VisitCommunityLot.Singleton.CreateInstance(baseCamp, createdSim, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, true);
                                    createdSim.InteractionQueue.AddAfterCheckingForDuplicates(instance);
                                    ths.UpdateFulfillingLot(baseCamp.LotId);
                                    return;
                                }
                            }
                        }

                        if (createdSim.LotCurrent != null)
                        {
                            if (ths.mFulfillingLotId == 0x0L)
                            {
                                ths.mFulfillingLotId = createdSim.LotCurrent.LotId;
                                ths.mMinInLot += minPassed;
                            }
                            else if (ths.mFulfillingLotId == createdSim.LotCurrent.LotId)
                            {
                                ths.mMinInLot += minPassed;
                            }
                            else if (!createdSim.IsRouting)
                            {
                                ths.UpdateFulfillingLot(createdSim.LotCurrent.LotId);
                            }
                        }
                    }
                }                
                else
                {
                    // needs tuning check
                    if (SimClock.HoursUntil(16) <= 6)
                    {
                        if (ths.mSim != null && ths.mSim.CreatedSim != null && ths.mSim.CreatedSim.CurrentInteraction == null)
                        {
                            if (ths.mSim.HomeWorld == WorldName.FutureWorld && ths.mSim.CreatedSim.Posture != null && ths.mSim.CreatedSim.Posture.ReactionAllowed())
                            {
                                // this is fun but naturally it breaks because EA
                               // ths.mSim.CreatedSim.PlayReaction(ReactionTypes.StandingAwe, ReactionSpeed.NowOrLater);
                            }
                        }

                        ths.SimulateRole(minPassed);
                    }
                    else
                    {
                        if (ths.mSim != null)
                        {
                            RestoreFutureTrait(ths.mSim);
//.........这里部分代码省略.........
开发者ID:Robobeurre,项目名称:NRaas,代码行数:101,代码来源:RoleTouristEx.cs


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