本文整理汇总了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;
}
}
示例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();
}
示例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 ) );
}
}
示例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);
}
示例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();
}