本文整理汇总了C#中Part.Module方法的典型用法代码示例。如果您正苦于以下问题:C# Part.Module方法的具体用法?C# Part.Module怎么用?C# Part.Module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.Module方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EngineFairingExplode
private void EngineFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
{
MonoBehaviour.print("Exploding Engine Fairing: " + part.ToString());
var module = part.Module<ModuleJettison>();
if (!module.isJettisoned)
{
if (!module.isFairing)
{
module.jettisonTransform.Translate(module.jettisonDirection * o.valueParam);
}
}
}
示例2: EngineFairingHide
private void EngineFairingHide(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
{
MonoBehaviour.print("Hiding Engine Fairing: " + part.ToString());
var module = part.Module<ModuleJettison>();
if (module.jettisonTransform)
{
foreach (var r in module.jettisonTransform.gameObject.GetComponentsInChildren<Renderer>())
{
r.enabled = false;
}
}
}
示例3: RadialDecouplerExplode
private void RadialDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
{
MonoBehaviour.print("Exploding Radial Decoupler: " + part.ToString());
var module = part.Module<ModuleAnchoredDecoupler>();
if (module.isDecoupled) return;
if (string.IsNullOrEmpty(module.explosiveNodeID)) return;
var an = module.explosiveNodeID == "srf" ? part.srfAttachNode : part.findAttachNode(module.explosiveNodeID);
if (an == null || an.attachedPart == null) return;
var distance = o.valueParam;
Part partToBeMoved;
if (an.attachedPart == part.parent)
{
distance *= -1;
partToBeMoved = part;
}
else
{
partToBeMoved = an.attachedPart;
}
partToBeMoved.transform.Translate(part.transform.right * distance, Space.World);
}
示例4: DockingPortExplode
private void DockingPortExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
{
MonoBehaviour.print("Exploding Docking Port: " + part.ToString());
var module = part.Module<ModuleDockingNode>();
if (string.IsNullOrEmpty(module.referenceAttachNode)) return;
var an = part.findAttachNode(module.referenceAttachNode);
if (!an.attachedPart) return;
var distance = o.valueParam;
Part partToBeMoved;
if (an.attachedPart == part.parent)
{
distance *= -1;
partToBeMoved = part;
}
else
{
partToBeMoved = an.attachedPart;
}
partToBeMoved.transform.Translate(module.nodeTransform.forward * distance, Space.World);
}
示例5: StackDecouplerExplode
private void StackDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
{
MonoBehaviour.print("Exploding Stack Decoupler: " + part.ToString());
var module = part.Module<ModuleDecouple>();
if (module.isDecoupled) return;
if (!part.parent) return;
Vector3 dir;
if (module.isOmniDecoupler)
{
foreach (var c in part.children)
{
dir = Vector3.Normalize(c.transform.position - part.transform.position);
c.transform.Translate(dir * o.valueParam, Space.World);
}
}
dir = Vector3.Normalize(part.transform.position - part.parent.transform.position);
part.transform.Translate(dir * o.valueParam, Space.World);
}
示例6: KASConnectorPortExplode
private void KASConnectorPortExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
{
if (hasMod("KAS"))
{
var module = part.Module<KAS.KASModulePort>();//this creates KAS Dependancy.
if (string.IsNullOrEmpty(module.attachNode)) return;
var an = part.findAttachNode(module.attachNode);
if (!an.attachedPart) return;
var distance = o.valueParam;
Part partToBeMoved;
if (an.attachedPart == part.parent)
{
distance *= -1;
partToBeMoved = part;
}
else
{
partToBeMoved = an.attachedPart;
}
partToBeMoved.transform.Translate(module.portNode.forward * distance, Space.World);
}
}
示例7: EngineFairingExplode
private void EngineFairingExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
{
var module = part.Module<ModuleJettison>();
if (!module.isJettisoned)
{
if (!module.isFairing)
{
module.jettisonTransform.Translate(module.jettisonDirection * o.valueParam);
}
}
}
示例8: RadialDecouplerExplode
private void RadialDecouplerExplode(VesselElementViewOptions ol, VesselElementViewOption o, Part part)
{
var module = part.Module<ModuleAnchoredDecoupler>();
if (module.isDecoupled) return;
if (!module.staged) return;
if (string.IsNullOrEmpty(module.explosiveNodeID)) return;
var an = module.explosiveNodeID == "srf" ? part.srfAttachNode : part.findAttachNode(module.explosiveNodeID);
if (an == null || an.attachedPart == null) return;
var distance = o.valueParam;
if (part.name.Contains("FairingCone"))
{
distance *= -1;
}
Part partToBeMoved;
if (an.attachedPart == part.parent)
{
distance *= -1;
partToBeMoved = part;
}
else
{
partToBeMoved = an.attachedPart;
}
partToBeMoved.transform.Translate(part.transform.right * distance, Space.World);
}
示例9: proceduralFairingToggleState
private void proceduralFairingToggleState(Boolean toggleOn, Part part)
{
if (part.Modules.Contains("ProceduralFairingSide") && hasMod("ProceduralFairings"))
{
var module = part.Module<Keramzit.ProceduralFairingSide>();
// Preserve ship's original fairing lock state.
if (toggleOn && !module.shapeLock)
{
module.shapeLock = true;
this.procFairings[part] = true;
}
else if (!toggleOn && this.procFairings.ContainsKey(part))
{
module.shapeLock = false;
}
}
}