private void Initialize() { _buildable = GetComponent <Constructable>() ?? GetComponentInParent <Constructable>(); if (FindComponents()) { QuickLogger.Debug($"Turbine Components Found", true); _prefabID = GetComponentInParent <PrefabIdentifier>(); var currentBiome = BiomeManager.GetBiome(); if (!string.IsNullOrEmpty(currentBiome)) { var data = BiomeManager.GetBiomeData(currentBiome); } AISolutionsData.Instance.OnRotationChanged += AiSolutionsDataOnOnRotationChanged; if (HealthManager == null) { HealthManager = gameObject.GetComponent <AIJetStreamT242HealthManager>() ?? GetComponentInParent <AIJetStreamT242HealthManager>(); } HealthManager.Initialize(this); HealthManager.SetHealth(100); HealthManager.SetDamageModel(_damage); if (PowerManager == null) { PowerManager = GetComponentInParent <AIJetStreamT242PowerManager>() ?? GetComponent <AIJetStreamT242PowerManager>(); PowerManager.maxPower = 300; } if (PowerRelay == null) { PowerRelay = gameObject.AddComponent <PowerRelay>(); PowerRelay.internalPowerSource = PowerManager; PowerRelay.maxOutboundDistance = 15; PowerRelay.dontConnectToRelays = false; PowerFX yourPowerFX = gameObject.AddComponent <PowerFX>(); PowerRelay powerRelay = CraftData.GetPrefabForTechType(TechType.SolarPanel).GetComponent <PowerRelay>(); yourPowerFX.vfxPrefab = powerRelay.powerFX.vfxPrefab; yourPowerFX.attachPoint = gameObject.transform; PowerRelay.powerFX = yourPowerFX; Resources.UnloadAsset(powerRelay); } PowerManager.Initialize(this); AnimationManager = gameObject.GetComponentInParent <AIJetStreamT242AnimationManager>(); BeaconManager = gameObject.GetComponentInParent <BeaconController>(); if (_display == null) { _display = GetComponent <AIJetStreamT242Display>() ?? GetComponentInParent <AIJetStreamT242Display>(); } IsInitialized = true; //_currentBiome = BiomeManager.GetBiome(); } else { IsInitialized = false; throw new MissingComponentException("Failed to find all components"); } if (!IsInitialized) { return; } PowerManager.OnKillBattery += Unsubscribe; }
private void Initialize() { _buildable = GetComponent <Constructable>() ?? GetComponentInParent <Constructable>(); if (FindComponents()) { QuickLogger.Debug($"Turbine Components Found", true); _prefabID = GetComponentInParent <PrefabIdentifier>(); var currentBiome = BiomeManager.GetBiome(); if (!string.IsNullOrEmpty(currentBiome)) { var data = BiomeManager.GetBiomeData(currentBiome); } AISolutionsData.Instance.OnRotationChanged += AiSolutionsDataOnOnRotationChanged; if (HealthManager == null) { HealthManager = gameObject.GetComponent <AIJetStreamT242HealthManager>() ?? GetComponentInParent <AIJetStreamT242HealthManager>(); } HealthManager.Initialize(this); HealthManager.SetHealth(100); HealthManager.SetDamageModel(_damage); if (PowerManager == null) { PowerManager = GetComponentInParent <AIJetStreamT242PowerManager>() ?? GetComponent <AIJetStreamT242PowerManager>(); } PowerManager.Initialize(this); AnimationManager = gameObject.GetComponentInParent <AIJetStreamT242AnimationManager>(); BeaconManager = gameObject.GetComponentInParent <BeaconController>(); if (_display == null) { _display = GetComponent <AIJetStreamT242Display>() ?? GetComponentInParent <AIJetStreamT242Display>(); } IsInitialized = true; //_currentBiome = BiomeManager.GetBiome(); } else { IsInitialized = false; throw new MissingComponentException("Failed to find all components"); } if (!IsInitialized) { return; } PowerManager.OnKillBattery += Unsubscribe; }