Example #1
0
        /// <summary>
        /// Event called when a new module is mounted at a module mount.
        /// </summary>
        /// <param name="moduleMount"></param>
        protected override void OnModuleMounted(Module module)
        {
            PowerPlant newPowerPlant = module == null ? null : module.transform.GetComponent <PowerPlant>();

            if (newPowerPlant != null)
            {
                mountedPowerPlant = newPowerPlant;
                hasPowerPlant     = true;
            }

            IPowerConsumer powerConsumer = module.GetComponent <IPowerConsumer>();

            if (powerConsumer != null)
            {
                powerConsumer.Power = this;
            }
        }
Example #2
0
        /// <summary>
        /// Event called when a new module is mounted at a module mount.
        /// </summary>
        /// <param name="moduleMount"></param>
        protected override void OnModuleMounted(Module module)
        {
            PowerPlant newPowerPlant = module == null ? null : module.transform.GetComponent <PowerPlant>();

            if (newPowerPlant != null)
            {
                powerPlant = newPowerPlant;

                if (fillStorageOnPowerPlantLoaded)
                {
                    for (int i = 0; i < poweredSubsystems.Count; ++i)
                    {
                        poweredSubsystems[i].currentStorageValue = poweredSubsystems[i].storageCapacity;
                    }
                }
            }

            IPowerConsumer powerConsumer = module.GetComponent <IPowerConsumer>();

            if (powerConsumer != null)
            {
                powerConsumer.Power = this;
            }
        }