本文整理汇总了C#中Role.SimulateRole方法的典型用法代码示例。如果您正苦于以下问题:C# Role.SimulateRole方法的具体用法?C# Role.SimulateRole怎么用?C# Role.SimulateRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Role
的用法示例。
在下文中一共展示了Role.SimulateRole方法的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);
//.........这里部分代码省略.........