本文整理汇总了C#中Pawn.TakeDamage方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.TakeDamage方法的具体用法?C# Pawn.TakeDamage怎么用?C# Pawn.TakeDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pawn
的用法示例。
在下文中一共展示了Pawn.TakeDamage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InteractWithPawn
/// <summary>
/// Damages the pawn.
/// </summary>
/// <param name="pawn">The pawn.</param>
protected override void InteractWithPawn(Pawn pawn)
{
// Cause fire damage.
pawn.TakeDamage(new DamageInfo(TrapDef.TrapDamageDef, Mathf.CeilToInt(_damageRange.RandomInRange), this));
// Create a fire source.
pawn.TryAttachFire(fireSize.RandomInRange);
}
示例2: InteractWithPawn
/// <summary>
/// Damages the pawn.
/// </summary>
/// <param name="pawn">The pawn.</param>
protected override void InteractWithPawn(Pawn pawn)
{
var bodyPartDamageInfo = new BodyPartDamageInfo(GetDamagedBodyPartHeight(), BodyPartDepth.Outside);
var num = Mathf.RoundToInt(this.GetStatValue(StatDefOf.TrapMeleeDamage)*TrapDamageFactor.RandomInRange);
var randomInRange = DamageCount.RandomInRange;
for (var index = 0; index < randomInRange && num > 0; ++index)
{
var amount = Mathf.Max(1, Mathf.RoundToInt(Rand.Value*num));
num -= amount;
pawn.TakeDamage(new DamageInfo(DamageDefOf.Stab, amount, this, bodyPartDamageInfo));
}
}
示例3: PawnResting
private void PawnResting(Pawn p)
{
if (p.needs.rest.CurLevel < 1)
{
float restEffectiveness = this.GetStatValue(StatDefOf.BedRestEffectiveness, true);
p.needs.rest.CurLevel += (restEffectiveness / 100);
int amount = 6;
int num = this.def.building.bed_healTickInterval;
if (p.health.hediffSet.GetNaturallyHealingInjuredParts().Any<BodyPartRecord>() && p.needs.food != null && !p.needs.food.Starving)
{
BodyPartRecord part = p.health.hediffSet.GetNaturallyHealingInjuredParts().RandomElement<BodyPartRecord>();
List<HediffDef> healHediff = (
from def in DefDatabase<HediffDef>.AllDefs
where def.naturallyHealed
select def).ToList<HediffDef>();
BodyPartDamageInfo value = new BodyPartDamageInfo(part, false, healHediff);
p.TakeDamage(new DamageInfo(DamageDefOf.HealInjury, amount, null, new BodyPartDamageInfo?(value), null));
if (p.health.ShouldGetTreatment && p.health.WantsToRemainInBedForMedicine && p.health.hediffSet.GetNaturallyHealingInjuredParts().Any<BodyPartRecord>())
{
object[] args = new object[]
{
p.LabelBaseShort
};
Messages.Message("MessageFullyHealed".Translate(args), MessageSound.Benefit);
}
}
}
}
示例4: InteractWithPawn
/// <summary>
/// Damages the pawn.
/// </summary>
/// <param name="pawn">The pawn.</param>
protected override void InteractWithPawn(Pawn pawn)
{
if (TriggerCount >= MaxTriggerCount)
return;
TriggerCount++;
pawn.TakeDamage(new DamageInfo(TrapDef.TrapDamageDef, Mathf.CeilToInt(_damageRange.RandomInRange), this));
}
示例5: InteractWithPawn
/// <summary>
/// Damages the pawn.
/// </summary>
/// <param name="pawn">The pawn.</param>
protected override void InteractWithPawn(Pawn pawn)
{
var bodyPartDamageInfo = new BodyPartDamageInfo(BodyPartHeight.Bottom, BodyPartDepth.Outside);
pawn.TakeDamage(new DamageInfo(TrapDef.TrapDamageDef, Mathf.CeilToInt(_damageRange.RandomInRange), this, bodyPartDamageInfo));
}