本文整理汇总了C#中IntVec3.InBounds方法的典型用法代码示例。如果您正苦于以下问题:C# IntVec3.InBounds方法的具体用法?C# IntVec3.InBounds怎么用?C# IntVec3.InBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntVec3
的用法示例。
在下文中一共展示了IntVec3.InBounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldLinkWith
public override bool ShouldLinkWith( IntVec3 c, Thing parent )
{
var compAir = parent.TryGetComp< CompAir >();
if ( compAir == null )
return false;
var lowerFlag = AirNetGrid.NetAt( c, NetLayer.Lower ) != null && compAir.IsLayerOf( NetLayer.Lower );
var upperFlag = AirNetGrid.NetAt( c, NetLayer.Upper ) != null && compAir.IsLayerOf( NetLayer.Upper );
return c.InBounds() && (lowerFlag || upperFlag);
}
示例2: CanDesignateCell
public override AcceptanceReport CanDesignateCell( IntVec3 c )
{
if (!c.InBounds())
{
return false;
}
if (!Game.GodMode && c.Fogged())
{
return false;
}
return TopDeconstructibleInCell( c ) != null;
}
示例3: CanDesignateCell
public override AcceptanceReport CanDesignateCell(IntVec3 c)
{
if (!c.InBounds())
{
return false;
}
if (CryptoAnimalsInCell(c).Count() == 0)
{
return "Must designate animal of faction";
}
return true;
}
示例4: CanDesignateCell
public override AcceptanceReport CanDesignateCell( IntVec3 c )
{
if( !c.InBounds() )
return "OutOfBounds".Translate();
if( c.Fogged() )
return "CannotPlaceInUndiscovered".Translate();
if( Find.DesignationManager.DesignationAt( c, DesignationDefOf.Mine ) != null )
return "SpaceAlreadyOccupied".Translate();
Thing mineable = MineUtility.MineableInCell( c );
if( ( mineable == null )||( !mineable.def.building.isResourceRock ) )
return "MessageMustDesignateMineable".Translate();
return AcceptanceReport.WasAccepted;
}
示例5: IsValidPositionToSpawnRefugeePod
public static bool IsValidPositionToSpawnRefugeePod(IntVec3 position)
{
ThingDef chunkDef = ThingDefOf.ShipChunk;
if ((position.InBounds() == false)
|| position.Fogged()
|| (position.Standable() == false)
|| (position.Roofed()
&& position.GetRoof().isThickRoof))
{
return false;
}
return true;
}
示例6: CanDesignateCell
// returning string text assigning false reason to AcceptanceReport
public override AcceptanceReport CanDesignateCell(IntVec3 cell)
{
if (!cell.InBounds() || cell.Fogged() || cell.ContainsStaticFire())
{
return false;
}
var firstItem = cell.GetFirstItem();
if (firstItem != null && CanDesignateThing(firstItem).Accepted)
{
return true;
}
return false;
}
示例7: CanDesignateCell
public override AcceptanceReport CanDesignateCell(IntVec3 c)
{
if (c.InBounds()
&& (c.Fogged() == false))
{
Area outpostArea = OG_Util.FindOutpostArea();
if ((outpostArea != null)
&& outpostArea.ActiveCells.Contains(c))
{
return "You cannot manage MiningCo. Outpost roof. This area does not belong to your colony.";
}
if (Find.RoofGrid.RoofAt(c) == OG_Util.IronedRoofDef)
{
return true;
}
}
return base.CanDesignateCell(c);
}
示例8: CanDesignateCell
// returning string text assigning false reason to AcceptanceReport
public override AcceptanceReport CanDesignateCell(IntVec3 loc)
{
if (!loc.InBounds())
{
return false;
}
if (loc.Fogged())
{
return false;
}
if (Find.DesignationManager.DesignationAt(loc, designationDef) != null)
{
return false;
}
if (!allowedTerrain.Contains(Find.TerrainGrid.TerrainAt(loc)))
{
return "Wrong terrain type";
}
return AcceptanceReport.WasAccepted;
}
示例9: CanDesignateCell
public override AcceptanceReport CanDesignateCell( IntVec3 c )
{
if( !c.InBounds() )
return "OutOfBounds".Translate();
if( c.Fogged() )
return "CannotPlaceInUndiscovered".Translate();
if( Find.DesignationManager.DesignationAt( c, SmoothWall.designationDef ) != null )
return "TerrainBeingSmoothed".Translate();
// Must be mineable
Thing mineable = MineUtility.MineableInCell( c );
if( mineable == null )
{
return "MessageMustDesignateMineable".Translate();
}
// Must have associated stone blocks
string blocksDef = "Blocks" + mineable.def.defName;
ThingDef stoneBlocks = DefDatabase<ThingDef>.GetNamed( blocksDef, false );
if( stoneBlocks == null )
{
return "MessageMustDesignateMineable".Translate();
}
return AcceptanceReport.WasAccepted;
}
示例10: FindHopperUser
public static Thing FindHopperUser( IntVec3 cell )
{
if( !cell.InBounds() )
{
// Out of bounds
return null;
}
var thingList = cell.GetThingList();
foreach( var thing in thingList )
{
var thingDef = GenSpawn.BuiltDefOf( thing.def ) as ThingDef;
if(
( thingDef != null )&&
( thingDef.IsHopperUser() )
)
{
// This thing wants a hopper
return thing;
}
}
// Nothing found
return null;
}
示例11: AlignQualityAgainst
private static int AlignQualityAgainst( IntVec3 sq )
{
if( !sq.InBounds() )
return 0;
//We align against anything unwalkthroughable and against blueprints for unwalkthroughable things
if( !sq.Walkable() )
return 9;
List<Thing> things = Find.ThingGrid.ThingsListAt(sq);
for(int i=0; i<things.Count; i++ )
{
Thing t = things[i];
if( t.def.eType == EntityType.Door )
return 1;
Thing blue = t as Blueprint;
if( blue != null )
{
if( blue.def.entityDefToBuild.passability == Traversability.Impassable )
return 9;
if( blue.def.eType == EntityType.Door )
return 1;
}
}
return 0;
}
示例12: ProtectSquare
private void ProtectSquare(IntVec3 square)
{
if (!square.InBounds())
{
return;
}
List<Thing> list = Find.ThingGrid.ThingsListAt(square);
List<Thing> list2 = new List<Thing>();
int i = 0;
int num = list.Count<Thing>();
while (i < num)
{
if (list[i] != null && list[i] is Projectile)
{
Projectile projectile = (Projectile)list[i];
if (!projectile.Destroyed)
{
bool flag = true;
if (flag)
{
Quaternion exactRotation = projectile.ExactRotation;
Vector3 exactPosition = projectile.ExactPosition;
exactPosition.y = 0f;
Vector3 b = Vectors.IntVecToVec(this.Position);
b.y = 0f;
Quaternion b2 = Quaternion.LookRotation(exactPosition - b);
if (Quaternion.Angle(exactRotation, b2) > 90f)
{
MoteThrower.ThrowLightningGlow(projectile.ExactPosition, 0.5f);
Building_DefenceShield.SoundAbsorbDamage.PlayOneShot(projectile.Position);
int damageAmountBase = projectile.def.projectile.damageAmountBase;
BodyPartDamageInfo value = new BodyPartDamageInfo(null, null);
DamageInfo dinfo = new DamageInfo(projectile.def.projectile.damageDef, damageAmountBase, projectile, projectile.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), null);
this.AbsorbedDamage(dinfo);
list2.Add(projectile);
if (!this.ShouldDisplay)
{
break;
}
}
}
}
}
i++;
}
foreach (Thing current in list2)
{
current.Destroy(DestroyMode.Vanish);
}
}
示例13: FindHopper
public static CompHopper FindHopper( IntVec3 cell )
{
//var str = string.Format( "CompHopperUser.FindHopper( {0} )", cell.ToString() );
if( !cell.InBounds() )
{
//Log.Message( str );
return null;
}
List<Thing> thingList = null;
if( Scribe.mode != LoadSaveMode.Inactive )
{ // Find hopper in world matching cell
if(
( Find.ThingGrid == null )||
( Find.ThingGrid.ThingsAt( cell ).Count() == 0 )
)
{
//Log.Message( str );
return null;
}
thingList = Find.ThingGrid.ThingsAt( cell ).ToList();
}
else
{ // Find hopper in cell
thingList = cell.GetThingList();
}
if( !thingList.NullOrEmpty() )
{
var hopper = thingList.FirstOrDefault( (thing) =>
{
var thingDef = GenConstruct.BuiltDefOf( thing.def ) as ThingDef;
return ( thingDef != null )&&( thingDef.IsHopper() );
} );
if( hopper != null )
{ // Found a hopper
//str += " = " + hopper.ThingID;
//Log.Message( str );
return hopper.TryGetComp<CompHopper>();
}
}
// No hopper found
//Log.Message( str );
return null;
}
示例14: AllowsPlacing
public override AcceptanceReport AllowsPlacing( BuildableDef def, IntVec3 center, Rot4 rot )
{
return center.InBounds();
}
示例15: ShouldLinkWith
public override bool ShouldLinkWith(IntVec3 c, Thing parent)
{
if (!c.InBounds())
return false;
return GasNetGrid.TransmittedGasNetAt(c) != null;
}