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


C# Sim.CreateRoute方法代码示例

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


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

示例1: GiveTipEx

        protected static int GiveTipEx(DJTurntable ths, Sim tipper, Sim player)
        {
            if (ths.mTipJar == null)
            {
                return 0;
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();
            destination.mCenterPoint = ths.mTipJar.Position;
            destination.mConeVector = ths.mTipJar.ForwardVector;
            destination.mFacingPreference = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle = 3.141593f;
            destination.mfMinRadius = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return 0;
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);

            int delta = 0;

            int dJLevel = ths.GetDJLevel(player);
            if (((dJLevel >= 0x0) && (dJLevel <= 0x5)) && (dJLevel >= DJTurntable.kMakeATipLevel))
            {
                delta = DJTurntable.kTipAmountPerLevel[dJLevel];
            }

            delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return delta;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:42,代码来源:WatchDJForTipsEx.cs

示例2: RouteNearEntranceAndEnterRabbitHole

        // replaces the method from RabbitHole class - identical except for new slot reassignment code
        public bool RouteNearEntranceAndEnterRabbitHole(Sim a, RabbitHole.IRabbitHoleFollowers inst, RabbitHole.BeforeEnteringRabbitHoleDelegate beforeEntering, bool canUseCar, Route.RouteMetaType routeMetaType, bool playRouteFailure)
        {
            if ((Target.RabbitHoleProxy.EnterSlots.Count == 0) || (Target.RabbitHoleProxy.ExitSlots.Count == 0))
            {
                return false;
            }
            if (a.IsInRidingPosture && ((Target.RabbitHoleProxy.MountedEnterSlots.Count == 0) || (Target.RabbitHoleProxy.MountedExitSlots.Count == 0)))
            {
                return false;
            }
            List<Sim> list = new List<Sim>();
            CarryingChildPosture posture = a.Posture as CarryingChildPosture;
            if (posture != null)
            {
                list.Add(posture.Child);
            }
            if (inst != null)
            {
                if (inst.SimFollowers != null)
                {
                    foreach (Sim sim in inst.SimFollowers)
                    {
                        posture = sim.Posture as CarryingChildPosture;
                        if (posture != null)
                        {
                            list.Add(posture.Child);
                        }
                    }
                    foreach (Sim sim2 in list)
                    {
                        inst.AddFollower(sim2);
                    }
                }
                else if (list.Count > 0)
                {
                    inst.AddFollower(list[0]);
                }
            }
            bool flag = false;
            Route item = null;
            Sim parent = null;
            if (a.IsInRidingPosture)
            {
                if (a.Parent is Sim)
                {
                    parent = a.Parent as Sim;
                }
                item = parent.CreateRoute();
                item.ExecutionFromNonSimTaskIsSafe = true;
            }
            else
            {
                item = a.CreateRoute();
            }
            bool flag2 = false;
            int kRouteAttemptsToEnterRabbitHole = RabbitHole.kRouteAttemptsToEnterRabbitHole;
            Slot slotToUse = Slot.None;
            while ((kRouteAttemptsToEnterRabbitHole > 0) && !flag2)
            {
                kRouteAttemptsToEnterRabbitHole--;
                try
                {
                    Target.RabbitHoleProxy.ActiveEntryRoutes.Add(item);
                    if (playRouteFailure)
                    {
                        item.DoRouteFail = kRouteAttemptsToEnterRabbitHole == 0;
                    }
                    item.SetOption(Route.RouteOption.EnablePlanningAsCar, canUseCar);
                    if (Target.mGuid == RabbitHoleType.Subway)
                    {
                        item.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                    }
                    if (Target.mGuid == RabbitHoleType.HoverTrainStation)
                    {
                        item.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false);
                    }
                    item.SetRouteMetaType(routeMetaType);
                    foreach (Slot slot2 in Target.RabbitHoleProxy.EnterSlots)
                    {
                        item.AddObjectToIgnoreForRoute(Target.RabbitHoleProxy.SlotToSlotInfo[slot2].Footprint.ObjectId);
                    }
                    foreach (Slot slot3 in Target.RabbitHoleProxy.MountedEnterSlots)
                    {
                        item.AddObjectToIgnoreForRoute(Target.RabbitHoleProxy.SlotToSlotInfo[slot3].Footprint.ObjectId);
                    }
                    item.PlanToSlot(Target.RabbitHoleProxy, (a.IsInRidingPosture ? Target.RabbitHoleProxy.MountedEnterSlots : Target.RabbitHoleProxy.EnterSlots).ToArray());
                    if (!item.PlanResult.Succeeded())
                    {
                        item.DoRouteFail = playRouteFailure;
                        if (a.IsInRidingPosture)
                        {
                            return parent.DoRoute(item);
                        }
                        return a.DoRoute(item);
                    }
                    slotToUse = (Slot)item.PlanResult.mDestSlotNameHash;

                    // Slot Reassignment
                    if ((Target.RabbitHoleProxy.EnterSlots.Count > 1) && (Target.RabbitHoleProxy.EnterSlots.Count <= 5))
//.........这里部分代码省略.........
开发者ID:KhArtNJava,项目名称:NRaas,代码行数:101,代码来源:GoToSchoolInRabbitHoleEx.cs


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