本文整理汇总了C#中Pawn.IsGuestOfColony方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.IsGuestOfColony方法的具体用法?C# Pawn.IsGuestOfColony怎么用?C# Pawn.IsGuestOfColony使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pawn
的用法示例。
在下文中一共展示了Pawn.IsGuestOfColony方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanArrestFor
public bool CanArrestFor( Pawn pawn )
{
if( pawn.IsSlaveOfColony() )
{
return arrestSlaves;
}
if( pawn.IsGuestOfColony() )
{
return arrestGuests;
}
if( pawn.IsColonist )
{
return arrestColonists;
}
return false;
}
示例2: PawnCanOpen
public override bool PawnCanOpen( Pawn p, bool isEscaping )
{
if( cachedRooms.Count == 0 )
{
UpdateCompStatus();
}
if( isEscaping )
{ // Escaping pawns don't care about restrictions
return true;
}
if( this.parent.IsForbiddenToPass( p ) )
{ // Other factions don't care about forbidden doors
//Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} IsForbiddenToPass", this.parent.ThingID, p.NameStringShort ) );
return false;
}
// Check animals
if(
( p.RaceProps.Animal )&&
( !AllowAnimals )
)
{
return false;
}
// Check colonists
if(
( p.IsColonist )&&
( !AllowColonists )&&
( !p.IsPrisonerOfColony )&&
( !p.Drafted )&&
( !p.workSettings.WorkIsActive( WorkTypeDefOf.Warden ) )&&
( !p.workSettings.WorkIsActive( WorkTypeDefOf.Doctor ) )
)
{ // Colonists have been told not to use this door
return false;
}
if(
(
( p.IsColonist )||
( p.Faction == Faction.OfPlayer )
)&&
( !p.IsPrisoner )
)
{ // Colonists & colony animals
//Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} IsColonist or Faction.OfPlayer", this.parent.ThingID, p.NameStringShort ) );
return true;
}
// Check non-prisoner guests
if( p.IsGuestOfColony() )
{
if( AllowGuests )
{ // Guests can use this door
//Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} IsAllowedGuest", this.parent.ThingID, p.NameStringShort ) );
return true;
}
// Guests can't use this door
//Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} IsNotAllowedGuest", this.parent.ThingID, p.NameStringShort ) );
return false;
}
if( cachedRooms.NullOrEmpty() )
{
// No room cache, can't check
//Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} cachedRooms is null", this.parent.ThingID, p.NameStringShort ) );
return false;
}
var pawnRoom = p.GetRoom();
bool checkPrisoners = p.IsPrisonerOfColony;
bool checkSlaves = p.IsSlaveOfColony();
// Slaves supercede prisoners
checkPrisoners &= !checkSlaves;
// Check on prisoners
if(
( AllowPrisoners )&&
( checkPrisoners )
)
{
foreach( var room in cachedRooms )
{
// Don't worry about room pawn is leaving
if( room == pawnRoom )
{
continue;
}
if( !room.isPrisonCell )
{ // Prisoners are only valid for prison cells
//Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} isPrisoner, room {2} !isPrisoncell", this.parent.ThingID, p.NameStringShort, room.ID ) );
return false;
}
}
// Room is valid for prisoners
//Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} isPrisoner, all rooms are prison cells", this.parent.ThingID, p.NameStringShort ) );
return true;
}
// Check on slaves
if(
( AllowSlaves )&&
( checkSlaves )
)
{
foreach( var room in cachedRooms )
{
//.........这里部分代码省略.........