public static void UpdateEventTubeLightList() { LightSwitchEventEffect[] lightSwitchEvents = Resources.FindObjectsOfTypeAll <LightSwitchEventEffect>(); foreach (LightSwitchEventEffect switchEffect in lightSwitchEvents) { ReflectionUtil.SetPrivateField( switchEffect, "_lights", BSLight.GetLightsWithID(switchEffect.LightsID) ); } }
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 <BSLight> ll = new List <BSLight>(); for (int j = 0; j < origLights.Length; j++) { BSLight[] origLl = origLights[j].GetField <BSLight[]>("_lights"); for (int k = 0; k < origLl.Length; k++) { GameObject g = GameObject.Instantiate(origLl[k].gameObject); BSLight nl = g.GetComponent <BSLight>(); 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); } }