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


C# Sim.GetDistanceToObject方法代码示例

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


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

示例1: OnTest

        public static bool OnTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                //bool isAutonomous = Common.IsAutonomous(actor);

                VaccinationSessionSituation situation = VaccinationSessionSituation.GetVaccinationSessionSituation(actor);
                if (situation != null)
                {
                    if (situation.IsInIgnoreList(target))
                    {
                        return false;
                    }
                    else if (!situation.IsInSeekersList(target) && !situation.IsInInterruptedList(target))
                    {
                        return false;
                    }
                    else if (isAutonomous && (actor.GetDistanceToObject(target) > AutographSessionSituation.MaxDistanceForAutonomousSign))
                    {
                        return false;
                    }

                    return true;
                }
                else
                {
                    FreeClinicSessionSituation freeClinicSessionSituation = FreeClinicSessionSituation.GetFreeClinicSessionSituation(actor);
                    if (freeClinicSessionSituation != null)
                    {
                        if (freeClinicSessionSituation.IsInIgnoreList(target))
                        {
                            return false;
                        }
                        else if (!freeClinicSessionSituation.IsInSeekersList(target) && !freeClinicSessionSituation.IsInInterruptedList(target))
                        {
                            return false;
                        }
                        else if (isAutonomous && (actor.GetDistanceToObject(target) > AutographSessionSituation.MaxDistanceForAutonomousSign))
                        {
                            return false;
                        }
                    }
                    else if (isAutonomous)
                    {
                        return false;
                    }
                }

                Medical medical = actor.Occupation as Medical;
                return ((medical != null) && (medical.Level >= 3));
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
                return false;
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:61,代码来源:Vaccinate.cs

示例2: OnAskedToGoSkinnyDipping

        public static void OnAskedToGoSkinnyDipping(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                Pool[] objects = actor.LotCurrent.GetObjects<Pool>();
                float num = 0f;
                Pool pool = null;

                foreach (Pool pool2 in objects)
                {
                    #region CHANGED
                    if (CanSkinnyDipAtLocation(actor, pool2.Position, ref greyedOutTooltipCallback))
                    #endregion
                    {
                        float distanceToObject = actor.GetDistanceToObject(pool2);
                        if ((pool == null) || (distanceToObject < num))
                        {
                            pool = pool2;
                            num = distanceToObject;
                        }
                    }
                }

                if (pool != null)
                {
                    GetInPool entry = GetInPool.SkinnyDipSingleton.CreateInstance(pool, actor, i.GetPriority(), true, true) as GetInPool;
                    GetInPool pool4 = GetInPool.SkinnyDipSingleton.CreateInstance(pool, target, i.GetPriority(), true, true) as GetInPool;
                    entry.SkinnyDippingBuddyID = target.SimDescription.SimDescriptionId;
                    pool4.SkinnyDippingBuddyID = actor.SimDescription.SimDescriptionId;
                    actor.InteractionQueue.AddNext(entry);
                    target.InteractionQueue.AddNext(pool4);
                }
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:39,代码来源:CommonSkinnyDip.cs


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