本文整理汇总了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);
}
}
}
示例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;
}