/// <summary>
        /// Called when this part gets enabled.
        /// </summary>
        private void OnEnable()
        {
            _kerbalKrash = part.GetComponent<KerbalKrashSystem>();

            _kerbalKrash.DamageReceived += _kerbalKrash_DamageReceived;
            _kerbalKrash.DamageRepaired += _kerbalKrash_DamageReceived;
        }
        /// <summary>
        /// Called everytime the part is enabled.
        /// </summary>
        private void OnEnable()
        {
            _kerbalKrash = part.GetComponent<KerbalKrashSystem>();

            _kerbalKrash.DamageReceived += _kerbalKrash_DamageReceived;
            _kerbalKrash.DamageRepaired += _kerbalKrash_DamageReceived;

            KerbalKrashSystem_KIS_Helper.EquipmentChanged += KerbalKrashSystem_KIS_Helper_EquipmentChanged;
        }
        private void ModuleKerbalKrashSystem_Command_DamageRepaired(KerbalKrashSystem sender, float damage)
        {
            if (damage >= DamageThreshold || !_wasDamaged)
            {
                return;
            }

            _wasDamaged = false;

            ScreenMessages.PostScreenMessage(part.partInfo.title + " restored!", 4, ScreenMessageStyle.UPPER_CENTER);
        }
        private void ModuleKerbalKrashSystem_Command_DamageReceived(KerbalKrashSystem sender, float damage)
        {
            if (damage < DamageThreshold || _wasDamaged)
            {
                return;
            }

            _wasDamaged = true;

            ScreenMessages.PostScreenMessage(part.partInfo.title + " damaged.", 4, ScreenMessageStyle.UPPER_CENTER);
        }
示例#5
0
        private void ModuleKerbalKrashSystem_Command_DamageRepaired(KerbalKrashSystem sender, float damage)
        {
            if (damage >= DamageThreshold || !_wasDamaged)
            {
                return;
            }

            //Get rid of airlock blockage.
            if (HatchMalfunction)
            {
                Destroy(_blockage);
            }

            _wasDamaged = false;

            ScreenMessages.PostScreenMessage(part.partInfo.title + " restored!", 4, ScreenMessageStyle.UPPER_CENTER);
        }
示例#6
0
        /// <summary>
        /// This event handler function is called when this part gets damaged.
        /// </summary>
        /// <param name="sender">Object firing the event.</param>
        /// <param name="damage">New damage percentage.</param>
        private void ModuleKerbalKrashEngine_DamageReceived(KerbalKrashSystem sender, float damage)
        {
            //Break the solar panel's when damage goes above 100%.
            if (damage > _damageThreshold)
            {
                _solarPanel.isBreakable = _originalBreakable;
                _solarPanel.breakPanels();
            }
            else
            {
                _solarPanel.deployState = ModuleDeployablePart.DeployState.RETRACTED;
                _solarPanel.part.State  = PartStates.IDLE;
                _solarPanel.part.State  = _solarPanel.part.PreFailState;
            }

            //Set the charge rate equal to the inverse of the damage percentage (and limit to 0% charge rate).
            _solarPanel.chargeRate = Math.Max(0.0f, _originalChargeRate * (1.0f - damage));
        }
 private void _kerbalKrash_DamageReceived(KerbalKrashSystem sender, float damage)
 {
     Events["Repair"].active = damage == 0;
     Events["Repair"].guiName = "Repair (" + damage.ToString("P") + ")";
 }
示例#8
0
        private void OnSplashdown(KerbalKrashSystem sender, Krash krash)
        {
            Krashes.Add(krash);

            ApplyKrash(krash);
        }
 private void ModuleKerbalKrashOther_DamageReceived(KerbalKrashSystem sender, float e)
 {
     if (Damage > 1)
         part.explode();
 }
 /// <summary>
 /// Called when this part gets enabled.
 /// </summary>
 private void OnEnable()
 {
     _kerbalKrash = part.GetComponent<KerbalKrashSystem>();
 }