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


C# IntVec3.GetFirstThing方法代码示例

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


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

示例1: SpawnCaveWellOpening

 private static void SpawnCaveWellOpening(IntVec3 position)
 {
     Thing potentialCaveWell = position.GetFirstThing(Util_CaveBiome.CaveWellDef);
     if (potentialCaveWell == null)
     {
         GenSpawn.Spawn(Util_CaveBiome.CaveWellDef, position);
     }
     foreach (IntVec3 checkedCell in GenAdjFast.AdjacentCells8Way(position))
     {
         potentialCaveWell = checkedCell.GetFirstThing(Util_CaveBiome.CaveWellDef);
         if (potentialCaveWell == null)
         {
             GenSpawn.Spawn(Util_CaveBiome.CaveWellDef, checkedCell);
         }
     }
 }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:16,代码来源:GenStep_CaveRoof.cs

示例2: IsValidPositionToGrowPlant

        /// <summary>
        /// Check if position is valid to grow a plant. Does not check cluster exclusivity!
        /// </summary>
        public static bool IsValidPositionToGrowPlant(ThingDef_ClusterPlant plantDef, IntVec3 position, bool checkTemperature = true)
        {
            if (position.InBounds() == false)
            {
                return false;
            }
            if (plantDef.isSymbiosisPlant)
            {
                // For symbiosis plant, only check there is a source symbiosis plant.
                if (position.GetFirstThing(plantDef.symbiosisPlantDefSource) != null)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            // Check there is no building or cover.
            if ((position.GetEdifice() != null)
                || (position.GetCover() != null))
            {
                return false;
            }
            // Check terrain condition.
            if (ClusterPlant.CanTerrainSupportPlantAt(plantDef, position) == false)
            {
                return false;
            }
            // Check temperature conditions.
            if (ClusterPlant.IsTemperatureConditionOkAt(plantDef, position) == false)
            {
                return false;
            }
            // Check light conditions.
            if (ClusterPlant.IsLightConditionOkAt(plantDef, position) == false)
            {
                return false;
            }
            // Check there is no other plant.
            if (Find.ThingGrid.ThingAt(position, ThingCategory.Plant) != null)
            {
                return false;
            }
            // Check the cell is not blocked by a plant, an item, a pawn, a rock...
	        List<Thing> thingList = Find.ThingGrid.ThingsListAt(position);
	        for (int thingIndex = 0; thingIndex < thingList.Count; thingIndex++)
	        {
                Thing thing = thingList[thingIndex];
                //Log.Message("checking thing + " + thing.ToString() + " at " + position.ToString());
		        if (thing.def.BlockPlanting)
		        {
			        return false;
		        }
		        if (plantDef.passability == Traversability.Impassable
                    && (thing.def.category == ThingCategory.Pawn
                        || thing.def.category == ThingCategory.Item
                        || thing.def.category == ThingCategory.Building
                        || thing.def.category == ThingCategory.Plant))
		        {
			        return false;
		        }
	        }
            // Check snow level.
            if (GenPlant.SnowAllowsPlanting(position) == false)
            {
                return false;
            }
            return true;
        }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:73,代码来源:GenClusterPlantReproduction.cs


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