本文整理汇总了C#中IntVec3类的典型用法代码示例。如果您正苦于以下问题:C# IntVec3类的具体用法?C# IntVec3怎么用?C# IntVec3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntVec3类属于命名空间,在下文中一共展示了IntVec3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DrawGhost
public override void DrawGhost( ThingDef def, IntVec3 center, Rot4 rot )
{
var vecNorth = center + IntVec3.North.RotatedBy( rot );
var vecSouth = center + IntVec3.South.RotatedBy( rot );
if ( !vecNorth.InBounds() || !vecSouth.InBounds() )
{
return;
}
GenDraw.DrawFieldEdges( new List< IntVec3 >
{
vecNorth
}, new Color( 1f, 0.7f, 0f, 0.5f ) );
GenDraw.DrawFieldEdges( new List< IntVec3 >
{
vecSouth
}, Color.white );
var controlledRoom = vecNorth.GetRoom();
var otherRoom = vecSouth.GetRoom();
if ( controlledRoom == null || otherRoom == null )
{
return;
}
if ( !controlledRoom.UsesOutdoorTemperature )
{
GenDraw.DrawFieldEdges( controlledRoom.Cells.ToList(), new Color( 1f, 0.7f, 0f, 0.5f ) );
}
}
开发者ID:ForsakenShell,项目名称:RimWorld-RedistHeat,代码行数:31,代码来源:PlaceWorker_ActiveVent.cs
示例2: DrawGhost
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot)
{
GenDraw.DrawFieldEdges(
FindUtil.SquareAreaAround(center, Mathf.RoundToInt(def.specialDisplayRadius))
.Where(cell => cell.Walkable() && cell.InBounds())
.ToList());
}
开发者ID:RWA-Team,项目名称:RimworldAscension,代码行数:7,代码来源:PlaceWorker_TradeCenterArea.cs
示例3: AllowsPlacing
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot)
{
string reason = "";
bool canBePlacedHere = Building_LaserFencePylon.CanPlaceNewPylonHere(loc, out reason);
if (canBePlacedHere == false)
{
return new AcceptanceReport(reason);
}
// Display potential placing positions.
foreach (Thing pylon in Find.ListerThings.ThingsOfDef(ThingDef.Named("LaserFencePylon").blueprintDef))
{
if (pylon.Position.InHorDistOf(loc, 6f))
{
Building_LaserFencePylon.DrawPotentialPlacePositions(pylon.Position);
}
}
foreach (Thing pylon in Find.ListerThings.ThingsOfDef(ThingDef.Named("LaserFencePylon").frameDef))
{
if (pylon.Position.InHorDistOf(loc, 6f))
{
Building_LaserFencePylon.DrawPotentialPlacePositions(pylon.Position);
}
}
foreach (Thing pylon in Find.ListerThings.ThingsOfDef(ThingDef.Named("LaserFencePylon")))
{
if (pylon.Position.InHorDistOf(loc, 6f))
{
Building_LaserFencePylon.DrawPotentialPlacePositions(pylon.Position);
}
}
return true;
}
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:34,代码来源:PlaceWorker_LaserFencePylon.cs
示例4: AllowsPlacing
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Thing thingToIgnore = null)
{
IEnumerable<IntVec3> cells = GenAdj.CellsAdjacent8Way(loc, rot, checkingDef.Size).Union<IntVec3>(GenAdj.CellsOccupiedBy(loc, rot, checkingDef.Size));
foreach (IntVec3 cell in cells)
{
List<Thing> things = Map.thingGrid.ThingsListAt(cell);
foreach (Thing thing in things)
{
if (thing.TryGetComp<CompRTQuantumStockpile>() != null
|| thing.TryGetComp<CompRTQuantumChunkSilo>() != null)
{
return "PlaceWorker_RTNoQSOverlap".Translate();
}
else if (thing.def.entityDefToBuild != null)
{
ThingDef thingDef = thing.def.entityDefToBuild as ThingDef;
if (null != thingDef &&
null != thingDef.comps &&
null != thingDef.comps.Find(x => typeof(CompRTQuantumStockpile) == x.compClass))
{
return "PlaceWorker_RTNoQSOverlap".Translate();
}
}
}
}
return true;
}
开发者ID:Ratysz,项目名称:RT_QuantumStorage,代码行数:27,代码来源:PlaceWorker_RTNoQSOverlap.cs
示例5: AllowsPlacing
public override AcceptanceReport AllowsPlacing( BuildableDef checkingDef, IntVec3 loc, Rot4 rot )
{
ThingDef def = checkingDef as ThingDef;
var Restrictions = def.GetCompProperties( typeof( RestrictedPlacement_Comp ) ) as RestrictedPlacement_Properties;
if( Restrictions == null ){
Log.Error( "Could not get restrictions!" );
return (AcceptanceReport)false;
}
// Override steam-geyser restriction
if( ( Restrictions.RestrictedThing.FindIndex( r => r == ThingDefOf.SteamGeyser ) >= 0 )&&
( ThingDefOf.GeothermalGenerator != ( checkingDef as ThingDef ) ) ){
var newGeo = checkingDef as ThingDef;
ThingDefOf.GeothermalGenerator = newGeo;
}
foreach( Thing t in loc.GetThingList() ){
if( ( Restrictions.RestrictedThing.Find( r => r == t.def ) != null )&&
( t.Position == loc ) )
return (AcceptanceReport)true;
}
return "MessagePlacementNotHere".Translate();
}
开发者ID:DAOWAce,项目名称:CommunityCoreLibrary,代码行数:25,代码来源:PlaceWorker_OnlyOnThing.cs
示例6: GenerateSmallRoomWeaponRoom
public static void GenerateSmallRoomWeaponRoom(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
{
IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);
OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, smallRoomWallOffset).RotatedBy(rotation), Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, rotation, TerrainDefOf.Concrete, TerrainDef.Named("MetalTile"), ref outpostData);
// Spawn weapon racks, weapons and lamps.
Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData)as Building_Storage;
TrySpawnWeaponOnRack(rack);
rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
rack.GetStoreSettings().Priority = StoragePriority.Critical;
rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 4, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
TrySpawnWeaponOnRack(rack);
rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
rack.GetStoreSettings().Priority = StoragePriority.Critical;
rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 2, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
TrySpawnWeaponOnRack(rack);
rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
rack.GetStoreSettings().Priority = StoragePriority.Critical;
rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
TrySpawnWeaponOnRack(rack);
rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
rack.GetStoreSettings().Priority = StoragePriority.Critical;
OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData);
OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData);
// Spawn vertical alley and door.
for (int zOffset = smallRoomWallOffset; zOffset <= Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset; zOffset++)
{
Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
}
OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset - 1).RotatedBy(rotation), ref outpostData);
}
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:33,代码来源:OG_ZoneSmallRoom.cs
示例7: ShieldField
//Constructor
public ShieldField(Building_Shield shieldBuilding, IntVec3 pos, int shieldMaxShieldStrength, int shieldInitialShieldStrength, int shieldShieldRadius, int shieldRechargeTickDelay, int shieldRecoverWarmup, bool shieldBlockIndirect, bool shieldBlockDirect, bool shieldFireSupression, bool shieldInterceptDropPod, bool shieldStructuralIntegrityMode, float colourRed, float colourGreen, float colourBlue)
{
this.shieldBuilding = shieldBuilding;
position = pos;
//shieldCurrentStrength = 0;
this.shieldMaxShieldStrength = shieldMaxShieldStrength;
this.shieldInitialShieldStrength = shieldInitialShieldStrength;
this.shieldShieldRadius = shieldShieldRadius;
this.shieldRechargeTickDelay = shieldRechargeTickDelay;
this.shieldRecoverWarmup = shieldRecoverWarmup;
this.shieldBlockIndirect = shieldBlockIndirect;
this.shieldBlockDirect = shieldBlockDirect;
this.shieldFireSupression = shieldFireSupression;
this.shieldInterceptDropPod = shieldInterceptDropPod;
this.shieldStructuralIntegrityMode = shieldStructuralIntegrityMode;
this.colourRed = colourRed;
this.colourGreen = colourGreen;
this.colourBlue = colourBlue;
//this.SIFBuildings = SIFBuildings;
//this.setupValidBuildings();
}
开发者ID:A-Nitram,项目名称:Jaxxa-Rimworld,代码行数:27,代码来源:ShieldField.cs
示例8: DesignateSingleCell
public override void DesignateSingleCell(IntVec3 c)
{
List<Thing> thingList = c.GetThingList();
foreach (var thing in thingList)
if (thing.def.category == ThingCategory.Item && !Find.Reservations.IsReserved(thing, Faction.OfColony))
designations.Add(new Designation(thing, DesignationDefOf.Haul));
}
开发者ID:BBream,项目名称:ToolsForHaul,代码行数:7,代码来源:Designator_PutInInventory.cs
示例9: AllowVerbCast
public override bool AllowVerbCast(IntVec3 root, TargetInfo targ)
{
if (this.wearer.equipment.Primary != null)
{
if (this.wearer.equipment.Primary.def.IsMeleeWeapon)
{
return true;
}
if (this.wearer.equipment.Primary.def.defName.Equals("Gun_Pistol"))
{
return true;
}
if (this.wearer.equipment.Primary.def.defName.Equals("Gun_PDW"))
{
return true;
}
if (this.wearer.equipment.Primary.def.defName.Equals("Gun_HeavySMG"))
{
return true;
}
if (this.wearer.equipment.Primary.def.weaponTags.Contains("MedievalShields_ValidSidearm"))
{
return true;
}
}
return root.AdjacentTo8Way(targ.Cell);
}
开发者ID:Skullywag,项目名称:MedievalShields,代码行数:27,代码来源:Apparel_Shield.cs
示例10: IsCellOpenForSowingPlantOfType
public static bool IsCellOpenForSowingPlantOfType(IntVec3 cell, ThingDef plantDef)
{
IPlantToGrowSettable plantToGrowSettable = GetPlayerSetPlantForCell(cell);
if (plantToGrowSettable == null || !plantToGrowSettable.CanAcceptSowNow())
return false;
ThingDef plantDefToGrow = plantToGrowSettable.GetPlantDefToGrow();
if (plantDefToGrow == null || plantDefToGrow != plantDef)
return false;
// check if there's already a plant occupying the cell
if (cell.GetPlant() != null)
return false;
// check if there are nearby cells which block growth
if (GenPlant.AdjacentSowBlocker(plantDefToGrow, cell) != null)
return false;
// check through all the things in the cell which might block growth
foreach (Thing tempThing in Find.ThingGrid.ThingsListAt(cell))
if (tempThing.def.BlockPlanting)
return false;
if (!plantDefToGrow.CanEverPlantAt(cell) || !GenPlant.GrowthSeasonNow(cell))
return false;
return true;
}
开发者ID:skyarkhangel,项目名称:Enviro-AI,代码行数:28,代码来源:Utils_Plants.cs
示例11: GetReport
public override string GetReport()
{
Vehicle_Cart cart = TargetThingA as Vehicle_Cart;
IntVec3 destLoc = new IntVec3(-1000, -1000, -1000);
string destName = null;
SlotGroup destGroup = null;
if (pawn.jobs.curJob.targetB != null)
{
destLoc = pawn.jobs.curJob.targetB.Cell;
destGroup = StoreUtility.GetSlotGroup(destLoc);
}
if (destGroup != null)
destName = destGroup.parent.SlotYielderLabel();
string repString;
if (destName != null)
repString = "ReportDismountingOn".Translate(cart.LabelCap, destName);
else
repString = "ReportDismounting".Translate(cart.LabelCap);
return repString;
}
开发者ID:BBream,项目名称:ToolsForHaul,代码行数:25,代码来源:JobDriver_DismountInBase.cs
示例12: CanDesignateCell
public override AcceptanceReport CanDesignateCell(IntVec3 c) {
if (mode == OperationMode.AllOfDef) {
return TryGetItemOrPawnUnderCursor() != null;
} else {
return base.CanDesignateCell(c);
}
}
开发者ID:UnlimitedHugs,项目名称:RimworldAllowTool,代码行数:7,代码来源:Designator_MassSelect.cs
示例13: DesignateSingleCell
public override void DesignateSingleCell(IntVec3 c)
{
Job jobNew = new Job(DefDatabase<JobDef>.GetNamed("Standby"), c, 4800);
driver.jobs.StartJob(jobNew, JobCondition.Incompletable);
DesignatorManager.Deselect();
}
开发者ID:BBream,项目名称:ToolsForHaul,代码行数:7,代码来源:Designator_Move.cs
示例14: TryGetRandomClusterSpawnCell
/// <summary>
/// Try to get a valid cell to spawn a new cluster anywhere on the map.
/// </summary>
public static void TryGetRandomClusterSpawnCell(ThingDef_ClusterPlant plantDef, int newDesiredClusterSize, bool checkTemperature, out IntVec3 spawnCell)
{
spawnCell = IntVec3.Invalid;
Predicate<IntVec3> validator = delegate(IntVec3 cell)
{
// Check a plant can be spawned here.
if (GenClusterPlantReproduction.IsValidPositionToGrowPlant(plantDef, cell) == false)
{
return false;
}
// Check there is no third cluster nearby.
if (GenClusterPlantReproduction.IsClusterAreaClear(plantDef, newDesiredClusterSize, cell) == false)
{
return false;
}
return true;
};
bool validCellIsFound = CellFinderLoose.TryGetRandomCellWith(validator, 1000, out spawnCell);
if (validCellIsFound == false)
{
// Just for robustness, TryGetRandomCellWith set result to IntVec3.Invalid if no valid cell is found.
spawnCell = IntVec3.Invalid;
}
}
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:29,代码来源:GenClusterPlantReproduction.cs
示例15: TrySpawnExplosionThing
public void TrySpawnExplosionThing(ThingDef thingDef, IntVec3 cell)
{
if (thingDef == null)
{
return;
}
if (thingDef.thingClass == typeof (LiquidFuel))
{
var liquidFuel = (LiquidFuel) Find.ThingGrid.ThingAt(cell, thingDef);
if (liquidFuel != null)
{
liquidFuel.Refill();
return;
}
}
// special skyfaller spawning
if (thingDef == ThingDef.Named("CobbleSlate"))
{
var impactResultThing = ThingMaker.MakeThing(ThingDef.Named("CobbleSlate"));
impactResultThing.stackCount = Rand.RangeInclusive(1, 10);
GenPlace.TryPlaceThing(impactResultThing, cell, ThingPlaceMode.Near);
return;
}
GenSpawn.Spawn(thingDef, cell);
}
开发者ID:RWA-Team,项目名称:RimworldAscension,代码行数:27,代码来源:RA_Explosion.cs
示例16: NetAt
public static AirNet NetAt( IntVec3 pos, NetLayer layer )
{
if(!AirNetTicker.doneInit)
AirNetTicker.Initialize();
return netGrid[(int)layer][CellIndices.CellToIndex( pos )];
}
开发者ID:ForsakenShell,项目名称:RimWorld-RedistHeat,代码行数:7,代码来源:AirNetGrid.cs
示例17: UpdateAffectedCellsInRect
private void UpdateAffectedCellsInRect(IntVec3 pos1, IntVec3 pos2) {
affectedCells.Clear();
// estabilish bounds
int minX, maxX, minZ, maxZ;
if (pos1.x <= pos2.x) {
minX = pos1.x;
maxX = pos2.x;
} else {
minX = pos2.x;
maxX = pos1.x;
}
if (pos1.z <= pos2.z) {
minZ = pos1.z;
maxZ = pos2.z;
} else {
minZ = pos2.z;
maxZ = pos1.z;
}
// check all items against bounds
var allTheThings = Find.ListerThings.AllThings;
for (var i = 0; i < allTheThings.Count; i++) {
var thing = allTheThings[i];
var thingPos = thing.Position;
if (thing.def.selectable && thingPos.x >= minX && thingPos.x <= maxX && thingPos.z >= minZ && thingPos.z <= maxZ && filterCallback(thing)) {
affectedCells.Add(thingPos);
}
}
}
开发者ID:UnlimitedHugs,项目名称:RimworldAllowTool,代码行数:29,代码来源:UnlimitedDesignationDragger.cs
示例18: GetFacingCell
protected void GetFacingCell(ref Pawn facingPawn, ref IntVec3 facingCell)
{
List<Pawn> nearbyPawns = new List<Pawn>();
foreach (Pawn colonist in Find.MapPawns.FreeColonists)
{
if (colonist == this.pawn)
{
continue;
}
if (colonist.Position.InHorDistOf(this.pawn.Position, 2f))
{
nearbyPawns.Add(colonist);
}
}
if (nearbyPawns.NullOrEmpty())
{
facingPawn = null;
facingCell = this.pawn.Position + new IntVec3(0, 0, 1).RotatedBy(new Rot4(Rand.Range(0, 4)));
}
else
{
facingPawn = nearbyPawns.RandomElement();
facingCell = facingPawn.Position;
}
}
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:25,代码来源:JobDriver_WanderAroundPyre.cs
示例19: AllowsPlacing
/// <summary>
/// Display the scan range of built mobile mineral sonar and the max scan range at the tested position.
/// Allow placement nearly anywhere.
/// </summary>
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot)
{
IEnumerable<Building> mobileMineralSonarList = Find.ListerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("MobileMineralSonar"));
if (mobileMineralSonarList != null)
{
foreach (Building mobileMineralSonar in mobileMineralSonarList)
{
(mobileMineralSonar as Building_MobileMineralSonar).DrawMaxScanRange();
}
}
ResearchProjectDef mmsResearch = ResearchProjectDef.Named("ResearchMobileMineralSonarEnhancedScan");
if (Find.ResearchManager.GetProgress(mmsResearch) >= mmsResearch.CostApparent)
{
Material scanRange30 = MaterialPool.MatFrom("Effects/ScanRange30");
Vector3 scanRangeScale30 = new Vector3(60f, 1f, 60f);
Matrix4x4 scanRangeMatrix30 = default(Matrix4x4);
// The 10f offset on Y axis is mandatory to be over the fog of war.
scanRangeMatrix30.SetTRS(loc.ToVector3Shifted() + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale30);
Graphics.DrawMesh(MeshPool.plane10, scanRangeMatrix30, scanRange30, 0);
}
else
{
Material scanRange50 = MaterialPool.MatFrom("Effects/ScanRange50");
Vector3 scanRangeScale50 = new Vector3(100f, 1f, 100f);
Matrix4x4 scanRangeMatrix50 = default(Matrix4x4);
// The 10f offset on Y axis is mandatory to be over the fog of war.
scanRangeMatrix50.SetTRS(loc.ToVector3Shifted() + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale50);
Graphics.DrawMesh(MeshPool.plane10, scanRangeMatrix50, scanRange50, 0);
}
return true;
}
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:38,代码来源:PlaceWorker_MobileMineralSonar.cs
示例20: MoveThingTo
protected override void MoveThingTo([NotNull] Thing thing, IntVec3 beltDest)
{
OnBeginMove(thing, beltDest);
// Slides only output to underground
BeltComponent belt = null;
var belts = beltDest.GetBeltUndergroundComponents();
var lift = belts.Find( b => b.IsLift() && b.outputDirection == this.outputDirection );
var under = belts.Find( tuc => tuc.IsUndercover() );
if( ( lift != null )&&
( ( lift.BeltPhase == Phase.Active )||
( under == null ) ) )
// Use the lift unless it's unpowered and there is an undertaker
belt = lift;
else
belt = under;
// Check if there is a belt, if it is empty, and also check if it is active !
if (belt == null || !belt.ItemContainer.Empty || belt.BeltPhase != Phase.Active)
{
return;
}
ItemContainer.TransferItem(thing, belt.ItemContainer);
// Need to check if it is a receiver or not ...
belt.ThingOrigin = parent.Position;
}
开发者ID:686d7066,项目名称:RW_A2B,代码行数:28,代码来源:BeltSlideComponent.cs
注:本文中的IntVec3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论