当前位置: 首页>>代码示例>>C#>>正文


C# IntVec3类代码示例

本文整理汇总了C#中IntVec3的典型用法代码示例。如果您正苦于以下问题:C# IntVec3类的具体用法?C# IntVec3怎么用?C# IntVec3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IntVec3类属于命名空间,在下文中一共展示了IntVec3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的IntVec3类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。