本文整理汇总了C#中Part.explode方法的典型用法代码示例。如果您正苦于以下问题:C# Part.explode方法的具体用法?C# Part.explode怎么用?C# Part.explode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.explode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExplodeLeafParts
// Destruction algorithm borrowed from TAC Self Destruct
private void ExplodeLeafParts(Part p)
{
int c = p.children.Count;
if (c == 0)
p.explode();
else
{
Part cP;
bool passAgain = true;
for (int i = c - 1; i >= 0; --i)
{
cP = p.children[i];
if (cP.Modules.Contains("ProceduralFairingSide")) // this is because fairing sides hold up interstages
// so if you blow the sides, then everything below the interstage becomes a new vessel, and will not
// go boom properly.
continue;
ExplodeLeafParts(cP);
passAgain = false;
}
if (passAgain)
{
for (int i = c - 1; i >= 0; --i)
ExplodeLeafParts(p.children[i]);
}
}
}
示例2: CreateExplosion
public void CreateExplosion(Part part)
{
float explodeScale = 0;
for (int i = 0; i < part.Resources.Count; i++)
{
var current = part.Resources[i];
switch (current.resourceName)
{
case "LiquidFuel":
explodeScale += (float)current.amount;
break;
case "Oxidizer":
explodeScale += (float)current.amount;
break;
}
}
explodeScale /= 100;
part.explode();
ExplosionFX.CreateExplosion(part.partTransform.position, explodeScale * blastRadius, explodeScale * blastPower * 2, explodeScale * blastHeat, part.vessel, FlightGlobals.upAxis, explModelPath, explSoundPath);
}
示例3: RecycleKerbal
public float RecycleKerbal(ProtoCrewMember crew, Part part)
{
// idea and numbers taken from Kethane
if (crew.isBadass && part != null) {
part.explosionPotential = 10000;
FlightGlobals.ForceSetActiveVessel (this.vessel);
}
string message = crew.name + " was mulched";
ScreenMessages.PostScreenMessage (message, 30.0f, ScreenMessageStyle.UPPER_CENTER);
if (part != null) {
FlightLogger.eventLog.Add ("[" + FormatTime (part.vessel.missionTime) + "] " + message);
part.explode ();
}
float mass = 0;
mass += ReclaimResource ("Kethane", 150, crew.name);
if (ExLaunchPad.kethane_present) {
mass += ReclaimResource ("Metal", 1, crew.name);
} else {
mass += ReclaimResource ("RocketParts", 1, crew.name);
}
return mass;
}
示例4: RecycleKerbal
public float RecycleKerbal(ProtoCrewMember crew, Part part)
{
// idea and numbers taken from Kethane
if (crew.isBadass && part != null) {
part.explosionPotential = 10000;
FlightGlobals.ForceSetActiveVessel (this.vessel);
}
string message = crew.name + " was mulched";
ScreenMessages.PostScreenMessage (message, 30.0f, ScreenMessageStyle.UPPER_CENTER);
if (part != null) {
FlightLogger.eventLog.Add ("[" + FormatTime (part.vessel.missionTime) + "] " + message);
part.explode ();
}
float mass = 0;
mass += ReclaimResource (ExSettings.KerbalRecycleTarget,
ExSettings.KerbalRecycleAmount, crew.name);
mass += ReclaimResource (ExSettings.HullRecycleTarget, 1, crew.name);
return mass;
}
示例5: tryExplode
private void tryExplode(Part p)
{
try
{
p.explode();
}
catch
{
p.Die();
}
}