本文整理汇总了C#中PartModule类的典型用法代码示例。如果您正苦于以下问题:C# PartModule类的具体用法?C# PartModule怎么用?C# PartModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PartModule类属于命名空间,在下文中一共展示了PartModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStart
public override void OnStart(PartModule.StartState state)
{
base.OnStart(state);
engine = part.Modules.OfType<ModuleEngines>().FirstOrDefault();
intake = part.Modules.OfType<ModuleResourceIntake>().FirstOrDefault();
toggleMenuItems(false);
}
示例2: OnStart
public override void OnStart(PartModule.StartState state)
{
SimManager.UpdateModSettings();
SimManager.OnReady -= this.GetStageInfo;
SimManager.OnReady += this.GetStageInfo;
base.OnAwake();
}
示例3: OnStart
public override void OnStart(PartModule.StartState state)
{
double time_diff = lastActiveTime - Planetarium.GetUniversalTime();
if (state == StartState.Editor)
return;
if (part.Resources.Contains(resourceName))
decay_resource = part.Resources[resourceName];
else
{
decay_resource = null;
return;
}
resourceDefinitionsContainDecayProduct = PartResourceLibrary.Instance.resourceDefinitions.Contains(decayProduct);
if (resourceDefinitionsContainDecayProduct)
density_rat = decay_resource.info.density / PartResourceLibrary.Instance.GetDefinition(decayProduct).density;
if (decay_resource != null && time_diff > 0)
{
double n_0 = decay_resource.amount;
decay_resource.amount = n_0 * Math.Exp(-decayConstant * time_diff);
double n_change = n_0 - decay_resource.amount;
if (resourceDefinitionsContainDecayProduct)
ORSHelper.fixedRequestResource(part, decayProduct, -n_change * density_rat);
}
}
示例4: OnStart
public override void OnStart(PartModule.StartState state)
{
Flap = part.FindModelTransform(flapTransform);
cachedRenderer = Flap.gameObject.GetComponent<Renderer>();
if (FlapActive != false)
ToggleFlaps();
}
示例5: OnStart
public override void OnStart(PartModule.StartState state)
{
base.OnStart(state);
if (HighLogic.LoadedSceneIsFlight) {
sensorInt = sensorTypeInt(sensorType);
Fields["readoutInfo"].guiName = guiReadout(sensorInt);
//Assign transforms for all of the indicator needles, etc.. for each part type
if (sensorInt == 1 || sensorInt == 2 || sensorInt == 3)
indicator = part.FindModelTransform(sensorType);
if (sensorInt == 3)
indicatorPosition = indicator.localPosition;
if (sensorInt == 4) {
rotor1 = part.FindModelTransform(sensorType + "_000");
rotor2 = part.FindModelTransform(sensorType + "_001");
rotor3 = part.FindModelTransform(sensorType + "_002");
tilt1 = part.FindModelTransform(sensorType + "_003");
}
//Prevent multiple modules from interfering with each other
if (primary) {
modList = this.part.FindModulesImplementing<DMEnviroSensor>();
if (modList.Count > 1) {
modList[0].Events["toggleSensor"].active = true;
modList[1].Events["toggleSensor"].active = false;
}
}
}
}
示例6: OnStart
public override void OnStart(PartModule.StartState state)
{
DragManager = part.gameObject.GetComponent<DragManager>();
if (DragManager == null) {
DragManager = part.gameObject.AddComponent<DragManager>();
DragManager.SetPart(part);
}
anim = part.FindModelAnimators(AnimationName)[0];
animState = anim[AnimationName];
animState.wrapMode = WrapMode.Clamp;
if (FixAnimLayers) {
int i = 0;
foreach (AnimationState s in anim)
s.layer = i++;
}
animState.normalizedSpeed = 0;
if (engaged) {
animState.normalizedTime = Drag / 100;
spoilerState = ModuleLandingGear.GearStates.DEPLOYED;
}
else {
animState.normalizedTime = 0;
spoilerState = ModuleLandingGear.GearStates.RETRACTED;
}
anim.Play(AnimationName);
}
示例7: OnStart
public override void OnStart(PartModule.StartState state)
{
this.part.force_activate();
animator = part.Modules.OfType<IExtractorAnimator>().SingleOrDefault();
if (animator == null)
{
animator = new DefaultExtractorAnimator();
}
else
{
Events["DeployDrill"].guiActiveEditor = true;
Events["RetractDrill"].guiActiveEditor = true;
}
headTransform = this.part.FindModelTransform(HeadTransform);
tailTransform = this.part.FindModelTransform(TailTransform);
if (state == StartState.Editor) { return; }
if (FlightGlobals.fetch == null) { return; }
emitters = part.Modules.OfType<KethaneParticleEmitter>().ToArray();
foreach (var emitter in emitters)
{
emitter.Setup();
emitter.EmitterTransform.parent = headTransform;
emitter.EmitterTransform.localRotation = Quaternion.identity;
}
}
示例8: OnStart
public override void OnStart(PartModule.StartState state)
{
base.OnStart(state);
if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris) && vessel.parts.Count > 1)
{
GameEvents.onGamePause.Add(new EventVoid.OnEvent(this.OnPause));
GameEvents.onGameUnpause.Add(new EventVoid.OnEvent(this.OnUnPause));
KFMW = this.part.GetComponentInChildren<KFModuleWheel>();
if (!Equals(KFMW, null))
tweakScaleCorrector = KFMW.tweakScaleCorrector;
KFLog.Warning(string.Format("TS Corrector: {0}", tweakScaleCorrector));
colliderList = Extensions.SplitString(colliderNames);
for (int i = 0; i < colliderList.Count(); i++)
{
colliders.Add(transform.SearchStartsWith(colliderList[i]).GetComponent<WheelCollider>());
objectCount++;
}
susTrav = transform.SearchStartsWith(susTravName);
initialPosition = susTrav.localPosition;
susTravIndex = Extensions.SetAxisIndex(susTravAxis);
MoveSuspension(susTravIndex, -lastFrameTraverse, susTrav); //to get the initial stuff correct
if (objectCount > 0)
{
//KFLog.Error(string.Format("lastFrameTraverse {0}", lastFrameTraverse));
StartCoroutine("WaitAndStart");
}
else
KFLog.Error("KFSuspension not configured correctly");
}
}
示例9: OnStart
public override void OnStart(PartModule.StartState state)
{
antimatter = part.Resources[InterstellarResourcesConfiguration.Instance.Antimatter];
if (state == StartState.Editor) return;
this.part.force_activate();
}
示例10: OnStart
public override void OnStart(PartModule.StartState state)
{
base.OnStart(state); // sets up the animation etc.
stateCount = heatAnimStates.Length;
SetDefaults();
}
示例11: IntegratedIntakeEngineCrossSectionAdjuster
public IntegratedIntakeEngineCrossSectionAdjuster(PartModule intake, Matrix4x4 worldToVesselMatrix)
{
this.part = intake.part;
intakeModule = intake as ModuleResourceIntake;
intakeTrans = intakeModule.intakeTransform;
//ModuleResourceIntake intake = intake;
/*vehicleBasisForwardVector = Vector3.forward;//intakeTrans.forward;
foreach(AttachNode node in part.attachNodes)
if(node.nodeType == AttachNode.NodeType.Stack && Vector3.Dot(node.position, (part.transform.worldToLocalMatrix * intakeTrans.localToWorldMatrix).MultiplyVector(Vector3.forward)) > 0)
{
frontNode = node;
break;
}*/
thisToVesselMatrix = worldToVesselMatrix * intakeTrans.localToWorldMatrix;
vehicleBasisForwardVector = Vector3.forward;
vehicleBasisForwardVector = thisToVesselMatrix.MultiplyVector(vehicleBasisForwardVector);
Type intakeType = intake.GetType();
intakeArea = (float)intakeType.GetField("Area").GetValue(intake);
}
开发者ID:sarbian,项目名称:Ferram-Aerospace-Research,代码行数:25,代码来源:IntegratedIntakeEngineCrossSectionAdjuster.cs
示例12: FromComponent
public static KISInventoryModuleWrapper FromComponent(PartModule component)
{
if (component != null)
return new KISInventoryModuleWrapper(component);
return null;
}
示例13: OnStart
public override void OnStart(PartModule.StartState state)
{
if (CloseAnimationName != "")
{
openAnim = true;
}
if (LoopAnimationName != "")
{
loopAnim = true;
}
if (HighLogic.LoadedSceneIsFlight)
{
intake = gameObject.GetComponent<ModuleResourceIntake>();
if (intake == null)
{
Utils.LogError("AnimatedIntake requires an intake module!");
return;
}
if (openAnim)
{
Utils.Log("Setting up close animation");
openStates = Utils.SetUpAnimation(CloseAnimationName, this.part);
}
if (loopAnim)
{
Utils.Log("Setting up loop animation");
loopStates = Utils.SetUpAnimation(LoopAnimationName, this.part);
}
}
}
示例14: OnStart
public override void OnStart(PartModule.StartState state)
{
if (state == StartState.Editor) { return; }
if (telescopeInit == false || lastMaintained == 0)
{
telescopeInit = true;
lastMaintained = (float)Planetarium.GetUniversalTime();
}
if (telescopeIsEnabled && lastActiveTime > 0)
{
calculateTimeToHeliumDepletion();
double t0 = lastActiveTime - lastMaintained;
double t1 = Math.Min(Planetarium.GetUniversalTime(), helium_depleted_time) - lastMaintained;
if (t1 > t0)
{
double a = -GameConstants.telescopePerformanceTimescale;
double base_science = dpo ? GameConstants.telescopeGLensScience : GameConstants.telescopeBaseScience;
double time_diff = Math.Min(Planetarium.GetUniversalTime(), helium_depleted_time) - lastActiveTime;
double avg_science_rate = 0.5*base_science * ( Math.Exp(a * t1) + Math.Exp(a * t0) );
double science_to_add = avg_science_rate / 28800 * time_diff;
lastActiveTime = (float)Planetarium.GetUniversalTime();
science_awaiting_addition += (float)science_to_add;
}
}
}
示例15: OnStart
public override void OnStart(PartModule.StartState state)
{
// Sync settings with the runtime
this.StartCoroutine("RuntimeFetch");
this.Events["TakeParts"].active = true;
}