public override void OnStart(PartModule.StartState state) { BaseTransform = this.part.transform.FindChild("model").FindChild("Kethane Small Miner").FindChild("Main Box"); Cyl3Transform = BaseTransform.FindChild("1 Cyl"); Cyl2Transform = Cyl3Transform.FindChild("2 Cyl"); Cyl1Transform = Cyl2Transform.FindChild("3 Cyl"); }
public override void OnStart(PartModule.StartState state) { if (state == StartState.Editor) { return; } this.part.force_activate(); #region Configuration if (FlightGlobals.fetch != null) { foreach (CelestialBody Body in FlightGlobals.Bodies) { CollsionLayerMask = 1 << Body.gameObject.layer; } } #endregion #region Sound effects DrillIn = gameObject.AddComponent <AudioSource>(); WWW dIn = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "PluginData/mmi_kethane/sounds/drillIn.wav"); if ((DrillIn != null) && (dIn != null)) { DrillIn.clip = dIn.GetAudioClip(false); DrillIn.volume = 2; DrillIn.Stop(); } DrillOut = gameObject.AddComponent <AudioSource>(); WWW dOut = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "PluginData/mmi_kethane/sounds/drillOut.wav"); if ((DrillOut != null) && (dOut != null)) { DrillOut.clip = dOut.GetAudioClip(false); DrillOut.volume = 0.25f; DrillOut.Stop(); } #endregion #region Child model parts BaseTransform = this.part.transform.FindChild("model").FindChild("Kethane Small Miner").FindChild("Main Box"); Cyl3Transform = BaseTransform.FindChild("1 Cyl"); Cyl2Transform = Cyl3Transform.FindChild("2 Cyl"); Cyl1Transform = Cyl2Transform.FindChild("3 Cyl"); #endregion #region Setup effects for (int i = 0; i < EffectsNumber; i++) { DigEffects[i] = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_gasJet_white")); DigEffects[i].name = "DigEffect" + i.ToString(); DigEffects[i].transform.parent = BaseTransform; DigEffects[i].gameObject.SetActive(false); } DigEffectRotations[0] = new Vector3(30, 0, 0); DigEffectRotations[1] = new Vector3(0, 0, 30); DigEffectRotations[2] = new Vector3(-30, 0, 0); DigEffectRotations[3] = new Vector3(0, 0, -30); UpdateEffects(); #endregion }