本文整理汇总了C#中IntVec3.IsForbidden方法的典型用法代码示例。如果您正苦于以下问题:C# IntVec3.IsForbidden方法的具体用法?C# IntVec3.IsForbidden怎么用?C# IntVec3.IsForbidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntVec3
的用法示例。
在下文中一共展示了IntVec3.IsForbidden方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JobOnCell
public override Job JobOnCell(Pawn pawn, IntVec3 cell)
{
// first run check to improve performance
if (!pawn.CanReserve(cell) || cell.IsForbidden(pawn)) return null;
// set plant to grow
DetermineWantedPlantDef(cell);
// cut improper plants in current cell
var plant = Find.ThingGrid.ThingAt<Plant>(cell);
if (plant != null)
{
if (plant.def != wantedPlantDef && Find.DesignationManager.DesignationOn(plant) == null)
{
DesignatePlantToCut(plant);
}
return null;
}
// cut improper adjucent sow blockers (trees)
var adjacentSowBlocker = GenPlant.AdjacentSowBlocker(wantedPlantDef, cell) as Plant;
if (adjacentSowBlocker != null)
{
if (Find.DesignationManager.DesignationOn(adjacentSowBlocker) == null)
{
var zoneGrowing = Find.ZoneManager.ZoneAt(adjacentSowBlocker.Position) as Zone_Growing;
if (zoneGrowing == null || zoneGrowing.GetPlantDefToGrow() != adjacentSowBlocker.def)
{
DesignatePlantToCut(adjacentSowBlocker);
}
}
return null;
}
// haul aside objects that block growing
var haulGarbageAsideJob = HaulGarbageAsideJob(cell, pawn);
if (haulGarbageAsideJob != null)
{
return haulGarbageAsideJob;
}
// cultivate or fertilize soil if needed
var growingZone = Find.ZoneManager.ZoneAt(cell) as RA_Zone_Growing;
if (growingZone != null)
{
if (growingZone.needsFertilization && cell.GetTerrain().defName.Contains("Cultivated"))
{
return pawn.CanReach(cell, PathEndMode.ClosestTouch, pawn.NormalMaxDanger())
? new Job(DefDatabase<JobDef>.GetNamedSilentFail("Fertilize"), cell)
: null;
}
if (growingZone.needsCultivation && !cell.GetTerrain().defName.Contains("Cultivated") && !cell.GetTerrain().defName.Contains("Fertilized"))
{
if (!Find.DesignationManager.AllDesignationsAt(cell).Any())
{
Find.DesignationManager.AddDesignation(new Designation(cell,
DefDatabase<DesignationDef>.GetNamedSilentFail("CultivateLand")));
}
return null;
}
}
// last check for allowed planting
if (wantedPlantDef.CanEverPlantAt(cell))
{
// plant
return new Job(JobDefOf.Sow, cell)
{
plantDefToSow = wantedPlantDef
};
}
// default exit
return null;
}