public void PlatformEnabled(DiContainer container) { container.Inject(this); bool activeSelf = gameObject.activeSelf; gameObject.SetActive(false); if (_instancedMaterialLightWithId is null && _tubeBloomPrePassLightWithId is null) { Mesh mesh = GetComponent <MeshFilter>().mesh; if (mesh.vertexCount == 0) { _tubeBloomPrePassLightWithId = gameObject.AddComponent <TubeBloomPrePassLightWithId>(); TubeBloomPrePassLight tubeBloomPrePassLight = gameObject.AddComponent <TubeBloomPrePassLight>(); GameObject boxLight = new("BoxLight"); boxLight.SetActive(false); Transform boxLightTransform = boxLight.transform; boxLightTransform.transform.SetParent(transform); boxLightTransform.transform.localRotation = Quaternion.Euler(Vector3.zero); MeshFilter meshFilter = boxLight.AddComponent <MeshFilter>(); meshFilter.mesh = Mesh; MeshRenderer renderer = boxLight.AddComponent <MeshRenderer>(); renderer.sharedMaterial = _materialSwapper !.TransparentGlowMaterial; ParametricBoxController parametricBoxController = boxLight.AddComponent <ParametricBoxController>(); _meshRendererAccessor(ref parametricBoxController) = renderer; _centerAccessor(ref tubeBloomPrePassLight) = center; _parametricBoxControllerAccessor(ref tubeBloomPrePassLight) = parametricBoxController; _mainEffectPostProcessEnabledAccessor(ref tubeBloomPrePassLight) = _postProcessEnabled; tubeBloomPrePassLight.width = width * 2; tubeBloomPrePassLight.length = length; tubeBloomPrePassLight.bloomFogIntensityMultiplier = bloomFogIntensityMultiplier; _tubeBloomPrePassLightAccessor(ref _tubeBloomPrePassLightWithId) = tubeBloomPrePassLight; BloomPrePassLight bloomPrePassLight = tubeBloomPrePassLight; _lightTypeAccessor(ref bloomPrePassLight) = BloomPrePassLight.bloomLightsDict.Keys.First(static x => x.name == "AddBloomPrePassLightType");
private void Init() { try { if (lightningLights == null || lightningLights.Length < 1 || lightningLights[0] == null) { LightSwitchEventEffect[] origLights = ColourManager.GetAllLightSwitches(); if (lightningLights != null) { for (int j = 0; j < lightningLights.Length; j++) { Destroy(lightningLights[j].gameObject); } } List <BloomPrePassLight> ll = new List <BloomPrePassLight>(); for (int j = 0; j < origLights.Length; j++) { BloomPrePassLight[] origLl = origLights[j].GetField <BloomPrePassLight[]>("_lights"); for (int k = 0; k < origLl.Length; k++) { GameObject g = GameObject.Instantiate(origLl[k].gameObject); BloomPrePassLight nl = g.GetComponent <BloomPrePassLight>(); nl.color = Color.clear; nl.name = "CT_LightningLight_" + k; foreach (Renderer r in nl.GetComponentsInChildren <Renderer>()) { r.enabled = false; } ll.Add(nl); } } lightningLights = ll.ToArray(); for (int i = 0; i < lightningLights.Length; i++) { lightningLights[i].transform.SetParent(transform, true); } ChromaLogger.Log("VFXLightning set up with " + lightningLights.Length + " lights cloned."); } } catch (Exception e) { ChromaLogger.Log("Error initializing VFXLightning"); ChromaLogger.Log(e); } }