Ejemplo n.º 1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            if (fixedUpdateHelper == null && HighLogic.LoadedSceneIsFlight)
            {
                fixedUpdateHelper = this.part.gameObject.AddComponent <FixedUpdateHelper>();
                fixedUpdateHelper.onFixedUpdateDelegate = OnUpdateFixed;
                fixedUpdateHelper.enabled = true;
            }

            ModuleDockingNode dockingNode = this.part.FindModuleImplementing <ModuleDockingNode>();

            if (!dockingNode)
            {
                return;
            }

            if (dockingNode.isEnabled)
            {
                Events["ToggleDockingPort"].guiName = "Disable Docking Port";
            }

            else
            {
                Events["ToggleDockingPort"].guiName = "Enable Docking Port";
            }
        }
Ejemplo n.º 2
0
        private void monitor_for_completion(ModuleDataTransmitter transmitter)
        {
            transmitterToMonitor     = transmitter;
            monitorTransmitterStatus = true;

            if (fixedUpdateHelper == null)
            {
                fixedUpdateHelper = this.part.gameObject.AddComponent <FixedUpdateHelper>();
                fixedUpdateHelper.onFixedUpdateDelegate = OnUpdateFixed;
            }
            fixedUpdateHelper.enabled = true;
        }
Ejemplo n.º 3
0
        public override void OnStart(StartState state)
        {
            if (animationLayer == kDefaultAnimationLayer)
            {
                animationLayer = kDefaultLightAnimationLayer;
            }

            base.OnStart(state);
            Animation[] animators = this.part.FindModelAnimators(animationName);
            if (animators != null && animators.Length >= 1)
            {
                Animation anim = animators[0];
                anim[animationName].layer = animationLayer;
            }

            //Find the lights
            lights = this.part.gameObject.GetComponentsInChildren <Light>();
            Log("THERE! ARE! " + lights.Length + " LIGHTS!");
            setupLights();

            if (string.IsNullOrEmpty(toggleFriendAnimation) == false)
            {
                List <WBIAnimation> animations = this.part.FindModulesImplementing <WBIAnimation>();
                int          totalCount        = animations.Count;
                WBIAnimation friendAnim;
                for (int index = 0; index < totalCount; index++)
                {
                    friendAnim = animations[index];
                    if (friendAnim.animationName == toggleFriendAnimation)
                    {
                        friendAnimation = friendAnim;
                        break;
                    }
                }
            }

            if (fixedUpdateHelper == null)
            {
                fixedUpdateHelper = this.part.gameObject.AddComponent <FixedUpdateHelper>();
                fixedUpdateHelper.onFixedUpdateDelegate = OnUpdateFixed;
            }
            fixedUpdateHelper.enabled = true;
        }
Ejemplo n.º 4
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            //Hide gui elements that we don't need.
            HideGUI();

            //Setup the engine
            SetEngineStateOnStart();

            Events["DebugReset"].guiActive      = showDebugButton;
            Events["ChargeCapacitor"].guiActive = showDebugButton;

            if (fixedUpdateHelper == null)
            {
                fixedUpdateHelper = this.part.gameObject.AddComponent <FixedUpdateHelper>();
                fixedUpdateHelper.onFixedUpdateDelegate = OnUpdateFixed;
            }
            fixedUpdateHelper.enabled = true;
        }
Ejemplo n.º 5
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            radiator           = this.part.FindModuleImplementing <ModuleActiveRadiator>();
            radiator.isEnabled = isDeployed && isCooling;
            radiator.enabled   = isDeployed && isCooling;

            emitter = this.part.GetComponentInChildren <KSPParticleEmitter>();
            if (emitter != null)
            {
                emitter.emit    = isDeployed && isCooling;
                emitter.enabled = isDeployed && isCooling;
            }

            UpdateStatus();

            if (isOpenCycle)
            {
                this.Events["ToggleOpenCycle"].guiName = "Open Cycle Off";
            }
            else
            {
                this.Events["ToggleOpenCycle"].guiName = "Open Cycle On";
            }

            if (isDeployed == false && this.part.Resources.Contains("Water"))
            {
                this.part.Resources["Water"].amount = 0;
            }

            if (fixedUpdateHelper == null)
            {
                fixedUpdateHelper = this.part.gameObject.AddComponent <FixedUpdateHelper>();
                fixedUpdateHelper.onFixedUpdateDelegate = OnUpdateFixed;
            }
            fixedUpdateHelper.enabled = true;
        }
Ejemplo n.º 6
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            //ModuleDeployableRadiator

            //Get the resource definition for electric charge.
            electricChargeDef = definitions["ElectricCharge"];

            //Set cooling mode. For now, default is closed.
            coolingCycleMode = CoolingCycleModes.closed;
            Events["ToggleCoolingMode"].guiName = "Cooling Mode (closed)";

            //Dig into the proto part and find the coolant resource nodes.
            getCoolantNodes();

            //Load the sound effects
            LoadSoundFX();

            //Create fixed update helper
            fixedUpdateHelper = this.part.gameObject.AddComponent <FixedUpdateHelper>();
            fixedUpdateHelper.onFixedUpdateDelegate = UpdateState;
            fixedUpdateHelper.enabled = true;
        }