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


C# IntVec3.CanReach方法代码示例

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


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

示例1: CanDesignateCell

 public override AcceptanceReport CanDesignateCell(IntVec3 loc)
 {
     if (loc.CanReach(vehicle, PathEndMode.OnCell, TraverseMode.ByPawn, Danger.Deadly))
         return true;
     else
         return new AcceptanceReport(txtCannotMove.Translate());
 }
开发者ID:BBream,项目名称:Vehicle,代码行数:7,代码来源:Designator_Move.cs

示例2: ClosestThing_Global_Reachable

        public static Thing ClosestThing_Global_Reachable(IntVec3 center, IEnumerable<Thing> searchSet, PathEndMode pathMode, TraverseParms traverseParams, float maxDistance, Pawn pawn)
        {
            if (searchSet == null)
            {
                return null;
            }
            int num = 0;
            int num2 = 0;
            Thing result = null;
            int num3 = -2147483648;
            int num4 = 0;
            float num5 = maxDistance * maxDistance;
            float num6 = 2.14748365E+09f;
            foreach (Thing current in searchSet)
            {
                num2++;
                float lengthHorizontalSquared = (center - current.Position).LengthHorizontalSquared;
                if (lengthHorizontalSquared <= num5)
                {
                    if (num4 > num3 || lengthHorizontalSquared < num6)
                    {
                        if (center.CanReach(current, pathMode, traverseParams))
                        {
                            if (current.SpawnedInWorld)
                            {

                                if(((Building_DroidChargePad)current).IsAvailable(pawn))
                                {
                                    result = current;
                                    num6 = lengthHorizontalSquared;
                                    num3 = num4;
                                    num++;
                                }
                            }
                        }
                    }
                }
            }
            return result;
        }
开发者ID:Leucetius,项目名称:MD2-Source,代码行数:40,代码来源:DroidChargerFinder.cs

示例3: PlaceSpotQualityAt

        // overhauled version (vanilla is bugged)
        public static PlaceSpotQuality PlaceSpotQualityAt(IntVec3 c, Thing thing, IntVec3 center)
        {
            if (!c.InBounds() || !c.Walkable())
            {
                return PlaceSpotQuality.Unusable;
            }

            List<Thing> list = Find.ThingGrid.ThingsListAt(c);

            // if other things on cell
            int i = 0;
            while (i < list.Count)
            {
                Thing thing2 = list[i];
                if (thing.def.saveCompressible && thing2.def.saveCompressible)
                {
                    return PlaceSpotQuality.Unusable;
                }
                // same thing type
                if (thing2.def.category == ThingCategory.Item)
                {
                    // can stack with
                    if (thing2.def == thing.def && thing2.stackCount < thing.def.stackLimit)
                    {
                        // can absorb
                        // Required, because thing reference is changed to the absorber, if absorbed
                        Thing t = thing2;
                        if (thing.TryAbsorbStack(thing2, true))
                        {
                            // Clean up to prevent haulables lists overflow
                            RemoveHaulableFromLists(t);
                            return PlaceSpotQuality.Perfect;
                        }
                        // cannot absorb all/anything
                        else
                            return PlaceSpotQuality.Unusable;
                    }
                    return PlaceSpotQuality.Unusable;
                }
                else
                {
                    i++;
                }
            }
            // if in same room
            if (c.GetRoom() == center.GetRoom())
            {
                PlaceSpotQuality placeSpotQuality = PlaceSpotQuality.Perfect;
                for (int j = 0; j < list.Count; j++)
                {
                    Thing thing3 = list[j];
                    if (thing3.def.thingClass == typeof(Building_Door))
                    {
                        return PlaceSpotQuality.Bad;
                    }
                    Pawn pawn = thing3 as Pawn;
                    if (pawn != null)
                    {
                        if (pawn.Downed)
                        {
                            return PlaceSpotQuality.Bad;
                        }
                        if (placeSpotQuality > PlaceSpotQuality.Okay)
                        {
                            placeSpotQuality = PlaceSpotQuality.Okay;
                        }
                    }
                    if (thing3.def.category == ThingCategory.Plant && thing3.def.selectable && placeSpotQuality > PlaceSpotQuality.Okay)
                    {
                        placeSpotQuality = PlaceSpotQuality.Okay;
                    }
                }
                return placeSpotQuality;
            }
            if (!center.CanReach(c, PathEndMode.OnCell, TraverseMode.PassDoors, Danger.Deadly))
            {
                return PlaceSpotQuality.Awful;
            }
            return PlaceSpotQuality.Okay;
        }
开发者ID:Wivex,项目名称:ContainersForStuff,代码行数:81,代码来源:JobDriver_HaulToCell.cs


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