public CyclopsManager(SubRoot cyclops, UpgradeManager upgradeManager, PowerManager powerManager, CyclopsHUDManager hUDManager, ChargeManager chargeManager) { UpgradeManager = upgradeManager; PowerManager = powerManager; HUDManager = hUDManager; ChargeManager = chargeManager; Cyclops = cyclops; InstanceID = cyclops.GetInstanceID(); }
private CyclopsManager(SubRoot cyclops) { QuickLogger.Debug($"Creating new main CyclopsManager"); Cyclops = cyclops; InstanceID = cyclops.GetInstanceID(); Upgrade = new UpgradeManager(cyclops); Charge = new ChargeManager(cyclops); HUD = new CyclopsHUDManager(cyclops); Engine = new PowerRatingManager(cyclops); }
private static CyclopsManager CreateNewManagers(SubRoot cyclops) { var upgradeMgr = new UpgradeManager(cyclops); var powerMgr = new PowerManager(cyclops); var hudManager = new CyclopsHUDManager(cyclops); var chargeMgr = new ChargeManager(cyclops); var mgr = new CyclopsManager(cyclops, upgradeMgr, powerMgr, hudManager, chargeMgr); Managers.Add(mgr); // Managers must be initialized in this order if (!upgradeMgr.Initialize(mgr) || !chargeMgr.Initialize(mgr) || !powerMgr.Initialize(mgr) || !hudManager.Initialize(mgr)) { QuickLogger.Error("Failed to initialized manager", true); Managers.Remove(mgr); return(null); } return(mgr); }
internal void SetupChargingUpgrades(int maxChargingModules) { UpgradeManager.RegisterOneTimeUseHandlerCreator(() => { QuickLogger.Debug("UpgradeHandler Registered: SolarCharger Upgrade"); SolarCharger = new ChargingUpgradeHandler(CyclopsModule.SolarChargerID) { MaxCount = maxChargingModules }; SolarCharger.OnFirstTimeMaxCountReached += () => { ErrorMessage.AddMessage(CyclopsModule.MaxSolarReached()); }; return(SolarCharger); }); UpgradeManager.RegisterOneTimeUseHandlerCreator(() => { QuickLogger.Debug("UpgradeHandler Registered: SolarChargerMk2 Upgrade"); SolarChargerMk2 = new BatteryUpgradeHandler(CyclopsModule.SolarChargerMk2ID, canRecharge: true) { MaxCount = maxChargingModules }; SolarChargerMk2.OnFirstTimeMaxCountReached += () => { ErrorMessage.AddMessage(CyclopsModule.MaxSolarReached()); }; SolarCharger.SiblingUpgrade = SolarChargerMk2; SolarChargerMk2.SiblingUpgrade = SolarCharger; return(SolarChargerMk2); }); UpgradeManager.RegisterOneTimeUseHandlerCreator(() => { QuickLogger.Debug("UpgradeHandler Registered: ThermalCharger Upgrade"); ThermalCharger = new ChargingUpgradeHandler(TechType.CyclopsThermalReactorModule) { MaxCount = maxChargingModules }; ThermalCharger.OnFirstTimeMaxCountReached += () => { ErrorMessage.AddMessage(CyclopsModule.MaxThermalReached()); }; return(ThermalCharger); }); UpgradeManager.RegisterOneTimeUseHandlerCreator(() => { QuickLogger.Debug("UpgradeHandler Registered: ThermalChargerMk2 Upgrade"); ThermalChargerMk2 = new BatteryUpgradeHandler(CyclopsModule.ThermalChargerMk2ID, canRecharge: true) { MaxCount = maxChargingModules }; ThermalChargerMk2.OnFirstTimeMaxCountReached += () => { ErrorMessage.AddMessage(CyclopsModule.MaxThermalReached()); }; ThermalCharger.SiblingUpgrade = ThermalChargerMk2; ThermalChargerMk2.SiblingUpgrade = ThermalCharger; return(ThermalChargerMk2); }); UpgradeManager.RegisterOneTimeUseHandlerCreator(() => { QuickLogger.Debug("UpgradeHandler Registered: NuclearReactor Upgrade"); NuclearCharger = new NuclearUpgradeHandler() { MaxCount = maxChargingModules }; return(NuclearCharger); }); UpgradeManager.RegisterOneTimeUseHandlerCreator(() => { QuickLogger.Debug("UpgradeHandler Registered: BioBooster Upgrade"); BioBoosters = new BioBoosterUpgradeHandler(); return(BioBoosters); }); }