本文整理汇总了C#中Pawn.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.ToString方法的具体用法?C# Pawn.ToString怎么用?C# Pawn.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pawn
的用法示例。
在下文中一共展示了Pawn.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGiveTerminalJob
protected override Job TryGiveTerminalJob(Pawn pawn)
{
TraverseParms traverseParams = TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, true);
JobDef huntJobDef = Animals_AI.GetHuntForAnimalsJobDef();
if ((pawn.jobs.curJob == null) || ((pawn.jobs.curJob.def != huntJobDef) && pawn.jobs.curJob.checkOverrideOnExpire))
{
Pawn threat = pawn.mindState.meleeThreat;
Pawn targetOfThreat = pawn;
if (threat == null)
{
IEnumerable<Pawn> herdMembers = HerdAIUtility_Pets.FindHerdMembers(pawn);
foreach (Pawn herdMember in herdMembers)
{
if (herdMember.mindState.meleeThreat != null)
{
threat = herdMember.mindState.meleeThreat;
pawn.mindState.meleeThreat = threat;
targetOfThreat = herdMember;
break;
}
}
}
bool foundinjury = false;
if (pawn.health.hediffSet.GetNaturallyHealingInjuredParts().Any<BodyPartRecord>() && (targetOfThreat.mindState.lastDisturbanceTick - Find.TickManager.TicksGame) > 400)
{
foundinjury = true;
Log.Message("Somebody attack " + pawn.ToString() + " and we found damage");
Pawn rangethreat = FindThreat(pawn, traverseParams);
if (rangethreat != null)
{
Log.Message("range threat found= " + rangethreat.ToString());
PawnPath pawnPath = PathFinder.FindPath(pawn.Position, rangethreat, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.PassDoors, false), PathEndMode.OnCell);
IntVec3 CellInFront;
Building_Door door = pawnPath.FirstBlockingBuilding(out CellInFront) as Building_Door;
if (door != null)
{
if (!door.Open)
{
// release the path
pawnPath.ReleaseToPool();
return new Job(Animals_AI.GetBashDoorJobDef(), CellInFront, door)
{
maxNumMeleeAttacks = 4,
//checkOverrideOnExpire = true,
expiryInterval = 500
};
}
}
return new Job(huntJobDef)
{
targetA = rangethreat,
maxNumMeleeAttacks = 4,
//checkOverrideOnExpire = true,
killIncappedTarget = true,
expiryInterval = 500
};
}
}
if (!foundinjury)
{
return null;
}
if (threat == null || threat.Dead || threat.Downed
|| (targetOfThreat.mindState.lastMeleeThreatHarmTick - Find.TickManager.TicksGame) > 300
|| (targetOfThreat.Position - threat.Position).LengthHorizontalSquared > HerdAIUtility_Pets.HERD_DISTANCE
|| !GenSight.LineOfSight(pawn.Position, threat.Position))
{
pawn.mindState.meleeThreat = null;
return null;
}
else
{
return new Job(huntJobDef)
{
targetA = threat,
maxNumMeleeAttacks = 4,
killIncappedTarget = true,
checkOverrideOnExpire = true,
expiryInterval = 500
};
}
}
return null;
}