本文整理汇总了C#中Pawn.GetCaravanRole方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.GetCaravanRole方法的具体用法?C# Pawn.GetCaravanRole怎么用?C# Pawn.GetCaravanRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pawn
的用法示例。
在下文中一共展示了Pawn.GetCaravanRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAndRemoveDynamicComponents
// assign Pawn_TraderTracker based on pawn caravan role, not mindState.wantsToTradeWithColony
public static void AddAndRemoveDynamicComponents(Pawn pawn, bool actAsIfSpawned = false)
{
var flag = pawn.Faction != null && pawn.Faction.IsPlayer;
var flag2 = pawn.HostFaction != null && pawn.HostFaction.IsPlayer;
if (pawn.RaceProps.Humanlike && (!pawn.Dead || actAsIfSpawned))
{
if (pawn.GetCaravanRole() == TraderCaravanRole.Trader)
{
if (pawn.trader == null)
{
pawn.trader = new Pawn_TraderTracker(pawn);
}
}
else
{
pawn.trader = null;
}
}
if (pawn.RaceProps.Humanlike)
{
if (flag)
{
if (pawn.outfits == null)
{
pawn.outfits = new Pawn_OutfitTracker(pawn);
}
if (pawn.drugs == null)
{
pawn.drugs = new Pawn_DrugPolicyTracker(pawn);
}
if (pawn.timetable == null)
{
pawn.timetable = new Pawn_TimetableTracker();
}
if ((pawn.Spawned || actAsIfSpawned) && pawn.drafter == null)
{
pawn.drafter = new Pawn_DraftController(pawn);
}
}
else
{
pawn.drafter = null;
}
}
if (flag || flag2)
{
if (pawn.playerSettings == null)
{
pawn.playerSettings = new Pawn_PlayerSettings(pawn);
}
}
if (pawn.RaceProps.intelligence <= Intelligence.ToolUser && pawn.Faction != null && !pawn.RaceProps.IsMechanoid && pawn.training == null)
{
pawn.training = new Pawn_TrainingTracker(pawn);
}
pawn.needs?.AddOrRemoveNeedsAsAppropriate();
}