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


C# IntVec3.GetEdifice方法代码示例

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


在下文中一共展示了IntVec3.GetEdifice方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPlayerSetPlantForCell

        public static IPlantToGrowSettable GetPlayerSetPlantForCell(IntVec3 cell)
        {
            IPlantToGrowSettable plantToGrowSettable = cell.GetEdifice() as IPlantToGrowSettable;
            if (plantToGrowSettable == null)
                plantToGrowSettable = Find.ZoneManager.ZoneAt(cell) as IPlantToGrowSettable;

            return plantToGrowSettable;
        }
开发者ID:skyarkhangel,项目名称:Enviro-AI,代码行数:8,代码来源:Utils_Plants.cs

示例2: DeconstructExistingEdificeJob

 public Job DeconstructExistingEdificeJob(Pawn pawn, RimWorld.Blueprint blue)
 {
     if (!blue.def.entityDefToBuild.IsEdifice())
     {
         return null;
     }
     Thing thing = null;
     var cellRect = blue.OccupiedRect();
     for (var i = cellRect.minZ; i <= cellRect.maxZ; i++)
     {
         var j = cellRect.minX;
         while (j <= cellRect.maxX)
         {
             var c = new IntVec3(j, 0, i);
             thing = c.GetEdifice();
             if (thing != null)
             {
                 var thingDef = blue.def.entityDefToBuild as ThingDef;
                 if (thingDef != null && thingDef.building.canPlaceOverWall && thing.def == ThingDefOf.Wall)
                 {
                     return null;
                 }
                 break;
             }
             j++;
         }
         if (thing != null)
         {
             break;
         }
     }
     if (thing == null || !pawn.CanReserve(thing))
     {
         return null;
     }
     return new Job(JobDefOf.Deconstruct, thing)
     {
         ignoreDesignations = true
     };
 }
开发者ID:RWA-Team,项目名称:RimworldAscension,代码行数:40,代码来源:WorkGiver_ConstructDeliverResourcesToBlueprints.cs

示例3: GenerateWarfield

        public void GenerateWarfield(int battleZoneAbs, int battleZoneOrd, OG_OutpostData outpostData)
        {
            // Get a random hostile faction.
            int securityForcesCorpseNumber = Rand.Range(2, 4);
            int hostilesCorpseNumber = 0;
            FactionDef hostileFactionDef = null;
            Faction hostileFaction = null;
            float hostileFactionSelector = Rand.Value;
            if (hostileFactionSelector < 0.25f)
            {
                hostileFactionDef = FactionDefOf.Tribe;
                hostileFaction = Find.FactionManager.FirstFactionOfDef(hostileFactionDef);
                hostilesCorpseNumber = Rand.Range(6, 8);
            }
            else if (hostileFactionSelector < 0.5f)
            {
                hostileFactionDef = FactionDefOf.Pirate;
                hostileFaction = Find.FactionManager.FirstFactionOfDef(hostileFactionDef);
                hostilesCorpseNumber = Rand.Range(3, 5);
            }
            else if (hostileFactionSelector < 0.75f)
            {
                hostileFactionDef = FactionDefOf.SpacerHostile;
                hostileFaction = Find.FactionManager.FirstFactionOfDef(hostileFactionDef);
                hostilesCorpseNumber = Rand.Range(3, 5);
            }
            else
            {
                hostileFactionDef = FactionDefOf.Mechanoid;
                hostileFaction = Find.FactionManager.FirstFactionOfDef(hostileFactionDef);
                hostilesCorpseNumber = Rand.Range(1, 3);
            }
            // Spawn corpses.
            IntVec3 zoneOrigin = Zone.GetZoneOrigin(outpostData.areaSouthWestOrigin, battleZoneAbs, battleZoneOrd);
            for (int corpseIndex = 0; corpseIndex < securityForcesCorpseNumber + hostilesCorpseNumber; corpseIndex++)
            {
                int tries = 3; // Max 3 tries per corpse.
                bool validPositionIsFound = false;
                IntVec3 corpsePosition = new IntVec3();
                for (int tryIndex = 0; tryIndex < tries; tryIndex++)
                {
                    corpsePosition = zoneOrigin + new IntVec3(Rand.Range(1, Genstep_GenerateOutpost.zoneSideSize - 1), 0, Rand.Range(1, Genstep_GenerateOutpost.zoneSideSize - 1));
                    if (corpsePosition.GetEdifice() == null)
                    {
                        validPositionIsFound = true;
                        break;
                    }
                }
                if (validPositionIsFound == false)
                {
                    continue;
                }
                // Generate the corpse according to the faction.
                Pawn corpse = null;
                if (corpseIndex < securityForcesCorpseNumber)
                {
                    corpse = PawnGenerator.GeneratePawn(OG_Util.OutpostScoutDef, OG_Util.FactionOfMiningCo);
                }
                else
                {
                    float pawnKindSelector = Rand.Value;
                    PawnKindDef corpseKindDef = null;
                    if (hostileFactionDef == FactionDefOf.Tribe)
                    {
                        if (pawnKindSelector < 0.4f)
                            corpseKindDef = PawnKindDef.Named("TribalWarrior");
                        else if (pawnKindSelector < 0.8f)
                            corpseKindDef = PawnKindDef.Named("TribalArcher");
                        else
                            corpseKindDef = PawnKindDef.Named("TribalChief");
                    }
                    else if (hostileFactionDef == FactionDefOf.Pirate)
                    {
                        if (pawnKindSelector < 0.25f)
                            corpseKindDef = PawnKindDef.Named("Drifter");
                        else if (pawnKindSelector < 0.50f)
                            corpseKindDef = PawnKindDef.Named("Scavenger");
                        else if (pawnKindSelector < 0.75f)
                            corpseKindDef = PawnKindDef.Named("Thrasher");
                        else
                            corpseKindDef = PawnKindDef.Named("Pirate");
                    }
                    else if (hostileFactionDef == FactionDefOf.SpacerHostile)
                    {
                        if (pawnKindSelector < 0.25f)
                            corpseKindDef = PawnKindDef.Named("SpaceSoldier");
                        else if (pawnKindSelector < 0.50f)
                            corpseKindDef = PawnKindDef.Named("MercenaryGunner");
                        else if (pawnKindSelector < 0.75f)
                            corpseKindDef = PawnKindDef.Named("GrenadierDestructive");
                        else
                            corpseKindDef = PawnKindDef.Named("MercenaryElite");
                    }
                    else if (hostileFactionDef == FactionDefOf.Mechanoid)
                    {
                        if (pawnKindSelector < 0.6f)
                            corpseKindDef = PawnKindDef.Named("Scyther");
                        else
                            corpseKindDef = PawnKindDef.Named("Centipede");
                    }
//.........这里部分代码省略.........
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:101,代码来源:Building_WarfieldGenerator.cs

示例4: SpawnDoorAt

 public static void SpawnDoorAt(IntVec3 position, ref OG_OutpostData outpostData)
 {
     ThingDef autodoorDef = OG_Util.FireproofAutodoorDef;
     Building edifice = position.GetEdifice();
     if ((edifice != null)
         && (edifice.def == autodoorDef))
     {
         // Avoid spawning another door on the same spot. This creates troubles with region links...
         return;
     }
     Thing door = OG_Common.TrySpawnThingAt(autodoorDef, ThingDefOf.Steel, position, false, Rot4.North, ref outpostData, false, true);
     CompForbiddable compForbiddable = door.TryGetComp<CompForbiddable>();
     if (compForbiddable != null)
     {
         compForbiddable.Forbidden = true; // Avoid colonists going into outpost at start-up.
     }
 }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:17,代码来源:OG_Common.cs

示例5: TrySpawnLampAt

 public static void TrySpawnLampAt(IntVec3 position, Color color, ref OG_OutpostData outpostData)
 {
     if (position.GetEdifice() != null)
     {
         return;
     }
     ThingDef lampDef = null;
     if (color == Color.red)
     {
         lampDef = ThingDef.Named("StandingLamp_Red");
     }
     else if (color == Color.green)
     {
         lampDef = ThingDef.Named("StandingLamp_Green");
     }
     else if (color == Color.blue)
     {
         lampDef = ThingDef.Named("StandingLamp_Blue");
     }
     else
     {
         lampDef = ThingDef.Named("StandingLamp");
     }
     OG_Common.TrySpawnThingAt(lampDef, null, position, false, Rot4.North, ref outpostData, true, false);
     Find.TerrainGrid.SetTerrain(position, TerrainDef.Named("MetalTile"));
 }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:26,代码来源:OG_Common.cs

示例6: TrySpawnThingAt

 public static Thing TrySpawnThingAt(ThingDef thingDef,
     ThingDef stuffDef,
     IntVec3 position,
     bool rotated,
     Rot4 rotation,
     ref OG_OutpostData outpostData,
     bool destroyThings = false,
     bool replaceStructure = false)
 {
     if (destroyThings)
     {
         List<Thing> thingList = position.GetThingList();
         for (int j = thingList.Count - 1; j >= 0; j--)
         {
             thingList[j].Destroy(DestroyMode.Vanish);
         }
     }
     Building building = position.GetEdifice();
     if (building != null)
     {
         if (replaceStructure)
         {
             if (outpostData.outpostThingList.Contains(building))
             {
                 outpostData.outpostThingList.Remove(building);
             }
             building.Destroy(DestroyMode.Vanish);
         }
         else
         {
             return null;
         }
     }
     Thing thing = ThingMaker.MakeThing(thingDef, stuffDef);
     outpostData.outpostThingList.Add(thing);
     thing.SetFaction(OG_Util.FactionOfMiningCo);
     if (rotated && thingDef.rotatable)
     {
         return GenSpawn.Spawn(thing, position, rotation);
     }
     else
     {
         if ((thingDef == ThingDef.Named("TableShort"))
             || (thingDef == ThingDef.Named("MultiAnalyzer")))
         {
             if (rotation == Rot4.East)
             {
                 position += new IntVec3(0, 0, -1);
             }
             else if (rotation == Rot4.South)
             {
                 position += new IntVec3(-1, 0, -1);
             }
             else if (rotation == Rot4.West)
             {
                 position += new IntVec3(-1, 0, 0);
             }
         }
         return GenSpawn.Spawn(thing, position);
     }
 }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:61,代码来源:OG_Common.cs

示例7: SpawnResourceAt

 public static void SpawnResourceAt(ThingDef resourceDef, int quantity, IntVec3 position, bool forceSpawn = false)
 {
     if ((position.GetEdifice() != null)
         && (forceSpawn == false))
     {
         return;
     }
     Thing thing = ThingMaker.MakeThing(resourceDef);
     thing.stackCount = quantity;
     thing.SetForbidden(true);
     GenSpawn.Spawn(thing, position);
 }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:12,代码来源:OG_Common.cs

示例8: IsValidPositionToGrowPlant

        /// <summary>
        /// Check if position is valid to grow a plant. Does not check cluster exclusivity!
        /// </summary>
        public static bool IsValidPositionToGrowPlant(ThingDef_ClusterPlant plantDef, IntVec3 position, bool checkTemperature = true)
        {
            if (position.InBounds() == false)
            {
                return false;
            }
            if (plantDef.isSymbiosisPlant)
            {
                // For symbiosis plant, only check there is a source symbiosis plant.
                if (position.GetFirstThing(plantDef.symbiosisPlantDefSource) != null)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            // Check there is no building or cover.
            if ((position.GetEdifice() != null)
                || (position.GetCover() != null))
            {
                return false;
            }
            // Check terrain condition.
            if (ClusterPlant.CanTerrainSupportPlantAt(plantDef, position) == false)
            {
                return false;
            }
            // Check temperature conditions.
            if (ClusterPlant.IsTemperatureConditionOkAt(plantDef, position) == false)
            {
                return false;
            }
            // Check light conditions.
            if (ClusterPlant.IsLightConditionOkAt(plantDef, position) == false)
            {
                return false;
            }
            // Check there is no other plant.
            if (Find.ThingGrid.ThingAt(position, ThingCategory.Plant) != null)
            {
                return false;
            }
            // Check the cell is not blocked by a plant, an item, a pawn, a rock...
	        List<Thing> thingList = Find.ThingGrid.ThingsListAt(position);
	        for (int thingIndex = 0; thingIndex < thingList.Count; thingIndex++)
	        {
                Thing thing = thingList[thingIndex];
                //Log.Message("checking thing + " + thing.ToString() + " at " + position.ToString());
		        if (thing.def.BlockPlanting)
		        {
			        return false;
		        }
		        if (plantDef.passability == Traversability.Impassable
                    && (thing.def.category == ThingCategory.Pawn
                        || thing.def.category == ThingCategory.Item
                        || thing.def.category == ThingCategory.Building
                        || thing.def.category == ThingCategory.Plant))
		        {
			        return false;
		        }
	        }
            // Check snow level.
            if (GenPlant.SnowAllowsPlanting(position) == false)
            {
                return false;
            }
            return true;
        }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:73,代码来源:GenClusterPlantReproduction.cs


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