本文整理汇总了C#中Route.SetOption2方法的典型用法代码示例。如果您正苦于以下问题:C# Route.SetOption2方法的具体用法?C# Route.SetOption2怎么用?C# Route.SetOption2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route.SetOption2方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reroute
private static void Reroute(Route r, IStation closest, IStation destination)
{
Sim target = r.Follower.Target as Sim;
Vector3 currentStartPoint = r.GetCurrentStartPoint();
float distanceRemaining = r.GetDistanceRemaining();
Route route = target.CreateRoute();
route.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
route.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false);
route.SetOption(Route.RouteOption.EnablePlanningAsCar, r.GetOption(Route.RouteOption.EnablePlanningAsCar));
route.SetOption(Route.RouteOption.PlanUsingStroller, r.GetOption(Route.RouteOption.PlanUsingStroller));
route.SetOption(Route.RouteOption.ReplanUsingStroller, r.GetOption(Route.RouteOption.ReplanUsingStroller));
route.SetOption(Route.RouteOption.BeginAsStroller, r.GetOption(Route.RouteOption.BeginAsStroller));
Slot routeEnterEndSlot = closest.RouteEnterEndSlot;
if (routeEnterEndSlot != Slot.None)
{
GameObject routingSlotEnterFootprint = closest.RoutingSlotEnterFootprint;
if (routingSlotEnterFootprint != null)
{
route.AddObjectToIgnoreForRoute(routingSlotEnterFootprint.ObjectId);
}
if (route.PlanToSlot(closest, routeEnterEndSlot).Succeeded())
{
Slot routeExitBeginSlot = destination.RouteExitBeginSlot;
Vector3 slotPosition = destination.GetSlotPosition(routeExitBeginSlot);
GameObject routingSlotExitFootprint = destination.RoutingSlotExitFootprint;
if (routingSlotExitFootprint != null)
{
r.AddObjectToIgnoreForRoute(routingSlotExitFootprint.ObjectId);
}
r.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
r.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false);
if (!r.ReplanFromPoint(slotPosition).Succeeded())
{
r.ReplanFromPoint(currentStartPoint);
}
else if ((route.GetDistanceRemaining() + r.GetDistanceRemaining()) < (distanceRemaining + SimRoutingComponent.kDistanceMustSaveInOrderToUseSubway))
{
if (closest is IHoverTrainStation)
{
r.ReplanAllowed = false;
Route route2 = target.CreateRoute();
PathType elevatedTrainPath = PathType.ElevatedTrainPath;
List<Vector3> list = new List<Vector3>();
list.Add(closest.GetSlotPosition(closest.RouteEnterEndSlot));
list.Add(destination.GetSlotPosition(destination.RouteExitBeginSlot));
if (list.Count > 0)
{
route2.InsertCustomPathAtIndex(0, list.ToArray(), false, true, elevatedTrainPath);
route2.ReplanAllowed = false;
RoutePlanResult planResult = route2.PlanResult;
planResult.mType = RoutePlanResultType.Succeeded;
route2.PlanResult = planResult;
PathData pathData = route2.GetPathData(0);
pathData.ObjectId = destination.ObjectId;
pathData.PathType = PathType.ElevatedTrainPath;
route2.SetPathData(ref pathData);
r.InsertRouteSubPathsAtIndex(0, route2);
}
}
r.InsertRouteSubPathsAtIndex(0x0, route);
r.SetOption(Route.RouteOption.EnableSubwayPlanning, true);
r.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, true);
}
else
{
r.ReplanFromPoint(currentStartPoint);
}
}
}
}
示例2: DebugMsg
/*
public static void DebugMsg(Sim sim, Common.StringBuilder msg, string text)
{
if (text != null)
{
msg += Common.NewLine + text;
}
if ((sim != null) && (sim.FirstName == "Roberto"))
{
Common.Notify(msg);
}
}
*/
public override bool DoRoute(Route r)
{
Sim routeSim = null;
if (!GoHere.Settings.mAllowCarRouting)
{
r.SetOption(Route.RouteOption.EnablePlanningAsCar, false);
r.SetOption(Route.RouteOption.BeginAsCar, false);
}
if (!GoHere.Settings.mAllowBoatRouting)
{
r.SetOption2(Route.RouteOption2.EnablePlanningAsBoat, false);
r.SetOption2(Route.RouteOption2.BeginAsBoat, false);
}
Common.StringBuilder msg = new Common.StringBuilder("DoRoute");
try
{
if (r.Follower != null)
{
routeSim = r.Follower.Target as Sim;
}
if ((routeSim != null) && (routeSim.Occupation != null))
{
if (routeSim.SimDescription.GetOutfitCount(OutfitCategories.Career) == 0)
{
routeSim.Occupation.SetOccupationOutfitForCurrentLevel();
}
}
if (!r.PlanResult.Succeeded())
{
msg += Common.NewLine + "A: " + r.PlanResult + " False";
DoRouteFailureBehavior(r);
mOwnerSim.AddExitReason(ExitReason.RouteFailed);
return false;
}
bool flag = false;
IGameObject destObj = r.DestObj as IGameObject;
try
{
if (destObj != null)
{
destObj.AddToRoutingReferenceList(mOwnerSim);
mOwnerSim.LookAtManager.SetRoutingLookAt(destObj as GameObject);
}
mbIgnoreAllObstaclesStartTimeValid = false;
if (mOwnerSim.IsActiveSim)
{
Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a3);
}
else if (mOwnerSim.IsInActiveHousehold)
{
Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a2);
}
else
{
Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a1);
}
while (true)
{
flag = false;
if (mbPushRequested)
{
if ((!(mOwnerSim.Posture is SittingInVehicle) && !(mOwnerSim.Posture is SittingInBoat)) && (mOwnerSim.RoutingComponent.RoutingParent == null))
{
try
{
MidRouteBePushed(r.ExecutionFromNonSimTaskIsSafe);
}
catch (ResetException)
{
throw;
}
catch (Exception e)
{
Common.Exception(routeSim, e);
}
//.........这里部分代码省略.........
示例3: SetRouteOptions
public static void SetRouteOptions(SimRoutingComponent ths, Route r, uint ageGenderFlags)
{
SimDescription simDescription = ths.OwnerSim.SimDescription;
Posture previousPosture = ths.OwnerSim.Posture;
if (!(ths.OwnerSim.CurrentInteraction is IHasCustomRouteOptions))
{
r.SetOption(Route.RouteOption.BeginAsCar, (ths.OwnerSim.Parent is Vehicle) && !(ths.OwnerSim.Parent is IBoat));
r.SetOption(Route.RouteOption.EnablePlanningAsCar, simDescription.ChildOrAbove);
r.SetOption(Route.RouteOption.DisablePlanningAsPedestrian, false);
r.SetOption(Route.RouteOption.PushSimsAtDestination, true);
r.SetOption(Route.RouteOption.UseAutoSlotFootprintLocking, true);
r.SetOption(Route.RouteOption.ReplanToFindObstacleWhenPathPlanFails, true);
r.SetOption(Route.RouteOption.IgnoreParent, false);
r.SetOption(Route.RouteOption.IgnoreChildren, false);
r.SetOption(Route.RouteOption.CreateSubPaths, true);
r.SetOption(Route.RouteOption.CheckForFootprintsNearGoals, true);
r.SetOption(Route.RouteOption.PenalizeGoalsOnDifferentLevels, true);
bool flag = false;
if (GameUtils.IsInstalled(ProductVersion.EP10))
{
IBoat parent = ths.OwnerSim.Parent as IBoat;
if (parent != null)
{
flag = true;
r.Follower = parent.Proxy;
r.FollowerAgeGenderSpecies = (uint)parent.GetBoatSpecies();
r.SetOption2(Route.RouteOption2.EnablePlanningAsBoat, true);
r.SetOption2(Route.RouteOption2.BeginAsBoat, true);
r.SetOption2(Route.RouteOption2.UseFollowerStartOrientation, true);
r.SetOption(Route.RouteOption.OffsetDestinationForLongAnimals, true);
r.AddObjectToIgnoreForRoute(ths.OwnerSim.ObjectId);
}
bool flag2 = OccultMermaid.IsEveryOneGroupedWithMeATeenOrAboveMermaid(ths.OwnerSim);
bool flag3 = false;
if (!flag2)
{
flag3 = ((previousPosture is CarryingChildPosture) || (previousPosture is CarryingPetPosture)) || ths.OwnerSim.Autonomy.SituationComponent.InSituationOfType(typeof(GoHereWithSituation));
}
bool flag4 = simDescription.ChildOrAbove & !(previousPosture is ScubaDiving);
flag4 &= !(ths.OwnerSim.InteractionQueue.GetHeadInteraction() is Lifeguard.GiveCPR);
flag4 &= !(ths.OwnerSim.InteractionQueue.GetHeadInteraction() is Lifeguard.FakeInjury);
flag4 &= !(simDescription.CreatedByService is GrimReaper);
flag4 &= !flag2 || flag3;
flag4 &= !(previousPosture is BeingRiddenPosture) && !(previousPosture is RidingPosture);
bool flag5 = simDescription.ChildOrAbove && simDescription.IsHuman;
flag5 &= !(previousPosture is CarryingChildPosture) && !(previousPosture is CarryingPetPosture);
r.SetOption(Route.RouteOption.EnableWaterPlanning, flag5);
r.SetOption2(Route.RouteOption2.DestinationMustBeOnLand, !flag5);
r.SetOption2(Route.RouteOption2.EnablePlanningAsBoat, (parent != null) || flag4);
if (flag2 && flag5)
{
r.SetOption2(Route.RouteOption2.RouteAsMermaid, true);
}
else
{
r.SetOption2(Route.RouteOption2.RouteAsLifeguard, Lifeguard.ShouldUseRescueSwimWade(ths.OwnerSim));
}
}
if (GameUtils.IsInstalled(ProductVersion.EP3))
{
r.SetOption(Route.RouteOption.EnableSubwayPlanning, true);
}
if (GameUtils.IsInstalled(ProductVersion.EP11)) /*&& GameUtils.IsFutureWorld())*/
{
r.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, true);
}
if (GameUtils.IsInstalled(ProductVersion.EP5) && ((ths.OwnerSim.IsWildAnimal || ths.OwnerSim.IsStray) || (ths.OwnerSim.IsUnicorn || WildHorses.IsWildHorse(ths.OwnerSim))))
{
r.SetOption2(Route.RouteOption2.EnablePlanningAsBoat, false);
r.SetOption2(Route.RouteOption2.DestinationMustBeOnLand, true);
}
if (ths.SimSatisfiesSpecialConditions())
{
r.SetOption(Route.RouteOption.PassThroughObjects, true);
r.SetOption(Route.RouteOption.PassThroughWalls, true);
}
if (ths.OwnerSim.HasGhostBuff && !flag)
{
r.SetOption(Route.RouteOption.RouteAsGhost, true);
}
if ((GameUtils.IsInstalled(ProductVersion.EP4) && (ths.OwnerSim.CarryingChildPosture != null)) && (Stroller.GetStroller(ths.OwnerSim, ths.OwnerSim.LotCurrent) != null))
{
r.SetOption(Route.RouteOption.PlanUsingStroller, true);
}
if (ths.OwnerSim.IsHuman)
{
SwimmingInPool pool = previousPosture as SwimmingInPool;
if (pool != null)
{
if (pool.ContainerIsOcean)
//.........这里部分代码省略.........