本文整理汇总了C#中Pawn.ComfortableTemperatureRange方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.ComfortableTemperatureRange方法的具体用法?C# Pawn.ComfortableTemperatureRange怎么用?C# Pawn.ComfortableTemperatureRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pawn
的用法示例。
在下文中一共展示了Pawn.ComfortableTemperatureRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: updateColonistStats
// stats recalculation routine
public void updateColonistStats(Pawn colonist)
{
if (!stats_dict.ContainsKey(colonist)) stats_dict.Add(colonist, new PawnStats());
PawnStats pawnStats = stats_dict[colonist];
///////////////////////////////////////////////////////////////
pawnStats.isNudist = false;
foreach (Trait trait in colonist.story.traits.allTraits)
{
switch (trait.def.defName)
{
case "Nudist":
pawnStats.isNudist = true;
break;
}
}
// efficiency
float efficiency = 10;
foreach (PawnCapacityDef act in pawnCapacities)
{
if (act != PawnCapacityDefOf.Consciousness) efficiency = Math.Min(efficiency, colonist.health.capacities.GetEfficiency(act));
}
if (efficiency < 0) efficiency = 0;
pawnStats.total_efficiency = efficiency;
// target
pawnStats.targetPos = Vector3.zero;
if (colonist.jobs.curJob != null)
{
JobDriver curDriver = colonist.jobs.curDriver;
Job curJob = colonist.jobs.curJob;
TargetInfo tp = curJob.targetA;
if (curDriver is JobDriver_HaulToContainer || curDriver is JobDriver_HaulToCell ||
curDriver is JobDriver_FoodDeliver || curDriver is JobDriver_FoodFeedPatient ||
curDriver is JobDriver_TakeToBed) tp = curJob.targetB;
if (curDriver is JobDriver_DoBill)
{
JobDriver_DoBill bill = (JobDriver_DoBill)curDriver;
if (bill.workLeft == 0.0f) tp = curJob.targetA;
else if (bill.workLeft <= 0.01f) tp = curJob.targetB;
//Log.Message("" + ((JobDriver_DoBill)colonist.jobs.curDriver).workLeft);
}
if (curDriver is JobDriver_Hunt)
{
if (colonist.carryHands != null && colonist.carryHands.CarriedThing != null)
tp = curJob.targetB;
}
if (curJob.def == JobDefOf.Wait) tp = null;
if (curDriver is JobDriver_Ingest) tp = null;
if (curJob.def == JobDefOf.LayDown && colonist.InBed()) tp = null;
if (!curJob.playerForced && curJob.def == JobDefOf.Goto) tp = null;
//Log.Message(colonist.jobs.curJob.def.ToString()+" "+colonist.jobs.curDriver.GetType().ToString());
if (tp != null && tp.Cell != null)
{
Vector3 pos = tp.Cell.ToVector3Shifted();
pawnStats.targetPos = pos + new Vector3(0.0f, 3.0f, 0.0f);
}
}
// temperature
float temper = GenTemperature.GetTemperatureForCell(colonist.Position);
pawnStats.tooCold = (colonist.ComfortableTemperatureRange().min - settings.limit_tempComfortOffset - temper) / 10.0f;
pawnStats.tooHot = (temper - colonist.ComfortableTemperatureRange().max - settings.limit_tempComfortOffset) / 10.0f;
pawnStats.tooCold = Mathf.Clamp(pawnStats.tooCold, 0, 2);
pawnStats.tooHot = Mathf.Clamp(pawnStats.tooHot, 0, 2);
// diseases
pawnStats.diseaseDisappearance = 1;
pawnStats.drunkness = DrugUtility.DrunknessPercent(colonist);
using (IEnumerator<Hediff_Staged> enumerator = colonist.health.hediffSet.GetDiseases().GetEnumerator())
{
while (enumerator.MoveNext())
{
Hediff_Staged disease = enumerator.Current;
if (disease == null || disease.FullyImmune || !disease.Visible) continue;
if (disease.CurStage != null && !disease.CurStage.everVisible) continue;
if (!disease.def.Treatable && !disease.def.naturallyHealed) continue;
pawnStats.diseaseDisappearance = Math.Min(pawnStats.diseaseDisappearance, disease.Immunity);
}
}
//.........这里部分代码省略.........