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


C# Route.AddObjectToIgnoreForRoute方法代码示例

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


在下文中一共展示了Route.AddObjectToIgnoreForRoute方法的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);
                    }
                }
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:72,代码来源:AncientPortalRoutingHelper.cs

示例2: DoRouteWithFollowers

        public static bool DoRouteWithFollowers(SimRoutingComponent ths, Route r, List<Sim> followers, GoHereWithSituation.OnFailBehavior failBehavior, Vector3 teleportLocation)
        {
            if ((followers != null) && (followers.Count != 0))
            {
                if (ths.OwnerSim.Autonomy.SituationComponent.InSituationOfType(typeof(GoHereWithSituation)))
                {
                    return false;
                }
                bool flag = r.PlanResult.Succeeded();
                if (!flag)
                {
                    RidingPosture ridingPosture = ths.OwnerSim.RidingPosture;
                    if (ridingPosture != null)
                    {
                        ObjectGuid objectId = ridingPosture.Mount.ObjectId;
                        r.AddObjectToIgnoreForRoute(objectId);
                        r.Replan();
                        r.RemoveObjectToIgnoreForRoute(objectId);
                        flag = r.PlanResult.Succeeded();
                    }
                }
                if (flag)
                {
                    InteractionInstance instance;
                    bool flag2 = false;
                    InteractionPriority priority = ths.OwnerSim.InheritedPriority();

                    // Custom
                    InteractionInstance entry = CreateGoHereWithInteractionInstance(ths, r, followers, priority, true, out instance, failBehavior, teleportLocation);
                    try
                    {
                        ths.mbAllowBikes = false;
                        if (instance != null)
                        {
                            entry.InstanceActor.InteractionQueue.Add(entry);
                        }
                        else
                        {
                            instance = entry;
                        }

                        InteractionInstance currentInteraction = ths.OwnerSim.CurrentInteraction;
                        currentInteraction.PartOfGoHereSituation = true;
                        instance.GroupId = currentInteraction.GroupId;
                        flag2 = instance.RunInteractionWithoutCleanup();
                        flag2 = flag2 && !entry.InstanceActor.HasExitReason(ExitReason.RouteFailed);
                    }
                    finally
                    {
                        ths.mbAllowBikes = true;
                        instance.Cleanup();
                    }
                    return flag2;
                }
                if ((ths.OwnerSim.IsInRidingPosture && (r.Follower.Target == ths.OwnerSim)) && (r.DoRouteFail && ths.mOwnerSim.CheckPlayRouteFailFrequency()))
                {
                    ths.PlayRouteFailureIfAppropriate(null);
                    return false;
                }
            }
            return ths.DoRoute(r);
        }
开发者ID:GnatGoSplat,项目名称:NRaas,代码行数:62,代码来源:SimRoutingComponentEx.cs

示例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)
//.........这里部分代码省略.........
开发者ID:Robobeurre,项目名称:NRaas,代码行数:101,代码来源:SimRoutingComponentEx.cs


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