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


C# IntVec3.Walkable方法代码示例

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


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

示例1: 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

示例2: CanSpawnMechanoidAt

 private bool CanSpawnMechanoidAt(IntVec3 c)
 {
     return c.Walkable();
 }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:4,代码来源:Building_CrashedShipPartCopy.cs

示例3: AlignQualityAgainst

    private static int AlignQualityAgainst( IntVec3 sq )
    {
        if( !sq.InBounds() )
            return 0;

        //We align against anything unwalkthroughable and against blueprints for unwalkthroughable things
        if( !sq.Walkable() )
            return 9;

        List<Thing> things = Find.ThingGrid.ThingsListAt(sq);
        for(int i=0; i<things.Count; i++ )
        {
            Thing t = things[i];

            if( t.def.eType == EntityType.Door )
                return 1;

            Thing blue = t as Blueprint;
            if( blue != null )
            {
                if( blue.def.entityDefToBuild.passability == Traversability.Impassable )
                    return 9;
                if( blue.def.eType == EntityType.Door )
                    return 1;
            }
        }

        return 0;
    }
开发者ID:raimis001,项目名称:raWorld,代码行数:29,代码来源:Building_Door.cs


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