本文整理汇总了C#中Pawn.GetApparelStatCache方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.GetApparelStatCache方法的具体用法?C# Pawn.GetApparelStatCache怎么用?C# Pawn.GetApparelStatCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pawn
的用法示例。
在下文中一共展示了Pawn.GetApparelStatCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Delete
public void Delete( Pawn pawn )
{
pawn.GetApparelStatCache()._cache.Remove( this );
}
示例2: ApparelScoreRaw
public static float ApparelScoreRaw( Apparel apparel, Pawn pawn )
{
// relevant apparel stats
HashSet<StatDef> equippedOffsets = new HashSet<StatDef>();
if ( apparel.def.equippedStatOffsets != null )
{
foreach ( StatModifier equippedStatOffset in apparel.def.equippedStatOffsets )
{
equippedOffsets.Add( equippedStatOffset.stat );
}
}
HashSet<StatDef> statBases = new HashSet<StatDef>();
if ( apparel.def.statBases != null )
{
foreach ( StatModifier statBase in apparel.def.statBases )
{
statBases.Add( statBase.stat );
}
}
// start score at 1
float score = 1;
// make infusions ready
InfusionSet infusions;
bool infused = false;
StatMod mod;
InfusionDef prefix = null;
InfusionDef suffix = null;
if ( apparel.TryGetInfusions( out infusions ) )
{
infused = true;
prefix = infusions.Prefix.ToInfusionDef();
suffix = infusions.Suffix.ToInfusionDef();
}
// add values for each statdef modified by the apparel
foreach( ApparelStatCache.StatPriority statPriority in pawn.GetApparelStatCache().StatCache )
{
// statbases, e.g. armor
if ( statBases.Contains( statPriority.Stat ) )
{
// add stat to base score before offsets are handled ( the pawn's apparel stat cache always has armors first as it is initialized with it).
score += apparel.GetStatValue( statPriority.Stat ) * statPriority.Weight;
}
// equipped offsets, e.g. movement speeds
if ( equippedOffsets.Contains( statPriority.Stat ) )
{
// base value
float norm = apparel.GetStatValue( statPriority.Stat );
float adjusted = norm;
// add offset
adjusted += apparel.def.equippedStatOffsets.GetStatOffsetFromList( statPriority.Stat ) *
statPriority.Weight;
// normalize
if ( norm != 0 )
{
adjusted /= norm;
}
// multiply score to favour items with multiple offsets
score *= adjusted;
//debug.AppendLine( statWeightPair.Key.LabelCap + ": " + score );
}
// infusions
if( infused ) {
// prefix
if ( !infusions.PassPre &&
prefix.GetStatValue( statPriority.Stat, out mod ) )
{
score += mod.offset * statPriority.Weight;
score += score * ( mod.multiplier - 1 ) * statPriority.Weight;
//debug.AppendLine( statWeightPair.Key.LabelCap + " infusion: " + score );
}
if ( !infusions.PassSuf &&
suffix.GetStatValue( statPriority.Stat, out mod ) )
{
score += mod.offset * statPriority.Weight;
score += score * ( mod.multiplier - 1 ) * statPriority.Weight;
//debug.AppendLine( statWeightPair.Key.LabelCap + " infusion: " + score );
}
}
}
// offset for apparel hitpoints
if ( apparel.def.useHitPoints )
{
// durability on 0-1 scale
float x = apparel.HitPoints / (float)apparel.MaxHitPoints;
score *= HitPointsPercentScoreFactorCurve.Evaluate( x );
}
// temperature
//.........这里部分代码省略.........