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


C# Thing.Destroy方法代码示例

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


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

示例1: ReplaceThingWithThingDefOfCount

 public static void ReplaceThingWithThingDefOfCount( Thing oldThing, ThingDef of, int count )
 {
     IntVec3 at = oldThing.Position;
     oldThing.Destroy();
     while( count > 0 )
     {
         Thing newStack = ThingMaker.MakeThing( of, null );
         newStack.stackCount = Math.Min( count, of.stackLimit );
         GenSpawn.Spawn( newStack, at );
         count -= newStack.stackCount;
     }
 }
开发者ID:RawCode,项目名称:CommunityCoreLibrary,代码行数:12,代码来源:CommonFunctions.cs

示例2: Notify_ReceivedThing

        // WARNING: there is a known bug when several pawns from different factions (Colony and MiningCo. for example) try to reserve the same cargo bay spot.
        // This can only be avoided by the player by setting proper authorized zones.

        public override void Notify_ReceivedThing(Thing newItem)
        {
            base.Notify_ReceivedThing(newItem);
            newItem.Destroy();
        }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:8,代码来源:Building_SupplyShipCargoBay.cs

示例3: DesignateThing

 public override void DesignateThing( Thing t )
 {
     if (t.Faction != Faction.OfColony)
     {
         t.SetFaction( Faction.OfColony );
     }
     var innerIfMinified = t.GetInnerIfMinified();
     if (Game.GodMode || Mathf.Approximately( innerIfMinified.GetStatValue( StatDefOf.WorkToMake ), 0 ) ||
         t.def.IsFrame)
     {
         t.Destroy( DestroyMode.Deconstruct );
     }
     else
     {
         Find.DesignationManager.AddDesignation( new Designation( t, DesignationDefOf.Deconstruct ) );
     }
 }
开发者ID:ChaosTherum,项目名称:RimWorld-RedistHeat,代码行数:17,代码来源:Designator_DeconstructReversed.cs

示例4: TryDropSpawn

 // duplicated to make changes
 public bool TryDropSpawn(Thing thing, IntVec3 dropCell, ThingPlaceMode mode, out Thing resultingThing)
 {
     if (!dropCell.InBounds())
     {
         Log.Error(string.Concat(new object[]
         {
             "Dropped ",
             thing,
             " out of bounds at ",
             dropCell
         }));
         resultingThing = null;
         return false;
     }
     if (thing.def.destroyOnDrop)
     {
         thing.Destroy(DestroyMode.Vanish);
         resultingThing = null;
         return true;
     }
     if (thing.def.soundDrop != null)
     {
         thing.def.soundDrop.PlayOneShot(dropCell);
     }
     // call duplicated to make changes
     return TryPlaceThing(thing, dropCell, mode, out resultingThing);
 }
开发者ID:Wivex,项目名称:ContainersForStuff,代码行数:28,代码来源:JobDriver_HaulToCell.cs

示例5: Impact

        public static void Impact(Thing skyfaller, Thing resultThing)
        {
            DoRoofPunch(skyfaller.Position);

            // max side length of drawSize or actual size etermine result crater radius
            var impactRadius = Mathf.Max(Mathf.Max(skyfaller.def.Size.x, skyfaller.def.Size.z), Mathf.Max(skyfaller.Graphic.drawSize.x, skyfaller.Graphic.drawSize.y)) * 2;

            // Throw some dust puffs
            for (var i = 0; i < 6; i++)
            {
                var loc = skyfaller.TrueCenter() + Gen.RandomHorizontalVector(1f);
                MoteMaker.ThrowDustPuff(loc, 1.2f);
            }

            // Throw a quick flash
            MoteMaker.ThrowLightningGlow(skyfaller.TrueCenter(), impactRadius);

            // Spawn the crater
            var crater = (Crater)ThingMaker.MakeThing(ThingDef.Named("Crater"));
            // adjust result crater size to the impact zone radius
            crater.impactRadius = impactRadius;
            // make explosion in the impact area
            DoImpactExplosion(skyfaller, impactRadius);

            // MapComponent Injector
            if (!Find.Map.components.Exists(component => component.GetType() == typeof(MapCompCameraShaker)))
                Find.Map.components.Add(new MapCompCameraShaker());

            // Do a bit of camera shake for added effect
            MapCompCameraShaker.DoShake(impactRadius * 0.02f);

            // spawn the crater, rotated to the random angle, to provide visible variety
            GenSpawn.Spawn(crater, skyfaller.Position, Rot4.North);
            // place the impact result thing
            //GenPlace.TryPlaceThing(resultThing, skyfaller.Position, ThingPlaceMode.Near);
            if (resultThing != null)
                GenSpawn.Spawn(resultThing, skyfaller.Position);

            // Destroy incoming pod
            skyfaller.Destroy();
        }
开发者ID:RWA-Team,项目名称:RimworldAscension,代码行数:41,代码来源:SkyfallerUtil.cs


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