Exemple #1
0
        public override void OnStart(StartState state)
        {
            _antimatterDefinition = PartResourceLibrary.Instance.GetDefinition(resourceName);
            _generator            = new AntimatterGenerator(part, efficiencyMultiplier, _antimatterDefinition);

            if (state == StartState.Editor)
            {
                return;
            }

            _disabledText = Localizer.Format("#LOC_KSPIE_AntimatterFactory_disabled");

            Fields["isActive"].guiName = Localizer.Format(activateTitle);

            if (!isActive)
            {
                return;
            }

            var deltaTime = Planetarium.GetUniversalTime() - lastActiveTime;

            var energyProvidedInMegajoules = electricalPowerRatio * powerCapacity * deltaTime;

            _generator.Produce(energyProvidedInMegajoules);
        }
        public override void OnStart(StartState state)
        {
            _antimatterDefinition = PartResourceLibrary.Instance.GetDefinition(resourceName);
            _generator            = new AntimatterGenerator(this.part, efficiencyMultiplier, _antimatterDefinition);

            if (state == StartState.Editor)
            {
                return;
            }

            if (!isActive)
            {
                return;
            }

            var deltaTime = Planetarium.GetUniversalTime() - last_active_time;

            var energy_provided_in_megajoules = electrical_power_ratio * powerCapacity * deltaTime;

            _generator.Produce(energy_provided_in_megajoules);
        }