public void Activate() { spin = gameObject.FindChild("Blade Parent").EnsureComponent <TurbineSpin>(); powerSource = gameObject.EnsureComponent <PowerSource>(); powerSource.maxPower = QPatch.config.MaxPower; relay = gameObject.EnsureComponent <PowerRelay>(); relay.internalPowerSource = powerSource; relay.dontConnectToRelays = false; relay.maxOutboundDistance = 50; //relay.powerSystemPreviewPrefab = Resources.Load<GameObject>("Base/Ghosts/PowerSystemPreview.prefab"); if (relayPrefab != null) { PowerFX yourPowerFX = gameObject.AddComponent <PowerFX>(); yourPowerFX.vfxPrefab = relayPrefab.powerFX.vfxPrefab; yourPowerFX.attachPoint = gameObject.transform; relay.powerFX = yourPowerFX; } #if SUBNAUTICA Resources.UnloadAsset(powerRelay); #endif relay.UpdateConnection(); if (QPatch.config.TurbineMakesNoise) { SetupAudio(); } Logger.Log(Logger.Level.Debug, $"WindTurbine.Activate: end"); }
// Token: 0x06002BB7 RID: 11191 RVA: 0x00104FDC File Offset: 0x001031DC private static void CreatePowerPreview(TechType constructableTechType, GameObject ghostModel) { GameObject gameObject = null; string poweredPrefabName = CraftData.GetPoweredPrefabName(constructableTechType); if (poweredPrefabName != string.Empty) { gameObject = PrefabDatabase.GetPrefabForFilename(poweredPrefabName); } if (gameObject != null) { PowerRelay component = gameObject.GetComponent <PowerRelay>(); if (component.powerFX != null && component.powerFX.attachPoint != null) { PowerFX powerFX = ghostModel.AddComponent <PowerFX>(); powerFX.attachPoint = new GameObject { transform = { parent = ghostModel.transform, localPosition = component.powerFX.attachPoint.localPosition } }.transform; } PowerRelay powerRelay = ghostModel.AddComponent <PowerRelay>(); powerRelay.maxOutboundDistance = component.maxOutboundDistance; powerRelay.dontConnectToRelays = component.dontConnectToRelays; if (component.internalPowerSource != null) { powerRelay.internalPowerSource = ghostModel.AddComponent <PowerSource>(); } } }
public void Activate() { spin = gameObject.FindChild("Blade Parent").AddComponent <TurbineSpin>(); powerSource = gameObject.AddComponent <PowerSource>(); powerSource.maxPower = QPatch.config.MaxPower; relay = gameObject.AddComponent <PowerRelay>(); relay.internalPowerSource = powerSource; relay.dontConnectToRelays = false; relay.maxOutboundDistance = 50; PowerFX yourPowerFX = gameObject.AddComponent <PowerFX>(); PowerRelay powerRelay = CraftData.GetPrefabForTechType(TechType.SolarPanel).GetComponent <PowerRelay>(); yourPowerFX.vfxPrefab = powerRelay.powerFX.vfxPrefab; yourPowerFX.attachPoint = gameObject.transform; relay.powerFX = yourPowerFX; Resources.UnloadAsset(powerRelay); relay.UpdateConnection(); if (QPatch.config.TurbineMakesNoise) { SetupAudio(); } }
private static void AlertedSetTarget(PowerFX arg1, GameObject arg2) { if (arg1 != null) { Log.Info($"Name {arg1.gameObject.name}"); if (arg2 != null) { Log.Info($"Name {arg2.name}"); } } }
private static void CreatePowerPreview() { GameObject gameObject = null; string poweredPrefabName = CraftData.GetPoweredPrefabName(constructableTechType); if (poweredPrefabName != string.Empty) { #pragma warning disable CS0618 //Ignore warning to use an async method when we need sync. gameObject = PrefabDatabase.GetPrefabForFilename(poweredPrefabName); #pragma warning restore CS0618 } if (gameObject == null) { return; } PowerRelay component = gameObject.GetComponent <PowerRelay>(); if (component.powerFX != null && component.powerFX.attachPoint != null) { PowerFX powerFX = ghostModel.AddComponent <PowerFX>(); powerFX.attachPoint = new GameObject { transform = { parent = ghostModel.transform, localPosition = component.powerFX.attachPoint.localPosition } }.transform; } PowerRelay powerRelay = ghostModel.AddComponent <PowerRelay>(); powerRelay.maxOutboundDistance = component.maxOutboundDistance; powerRelay.dontConnectToRelays = component.dontConnectToRelays; if (component.internalPowerSource != null) { powerRelay.internalPowerSource = ghostModel.AddComponent <PowerSource>(); } }
public void Start() { PDAEncyclopedia.Add(DeepEngine._ClassID, true); //Activate PowerRelay solarPowerRelay = CraftData.GetPrefabForTechType(TechType.SolarPanel).GetComponent <PowerRelay>(); _powerSource = this.gameObject.AddComponent <PowerSource>(); _powerSource.maxPower = QPatch.Config.MaxPowerAllowed; _powerFX = this.gameObject.AddComponent <PowerFX>(); _powerFX.vfxPrefab = solarPowerRelay.powerFX.vfxPrefab; _powerFX.attachPoint = this.gameObject.transform; _powerRelay = this.gameObject.AddComponent <PowerRelay>(); _powerRelay.powerFX = _powerFX; _powerRelay.maxOutboundDistance = 15; _powerRelay.internalPowerSource = _powerSource; // Play Audio SetupAudio(); //Start coroutines StartCoroutine(EmitEnergy()); StartCoroutine(UpdateUI()); }
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; }