//============================================================ void OnDisable() { _initFlag = false; _last = null; _first = null; EchoGameObject._systemInitFlag = false; }
void OnDestroy() { _initFlag = false; _last = null; _first = null; EchoGameObject._systemInitFlag = false; EchoFXEvent.poolListID = -1; }
//============================================================ public static void RemoveList(EchoLight iel) { if (!iel.inList) { return; } iel.inList = false; if (_first == null) { return; } if (iel.prev != null) { iel.prev.next = iel.next; } if (iel.next) { iel.next.prev = iel.prev; } if (iel == _first && iel == _last) { _use4ExtraPoint = false; _last = null; _first = null; Set4ExtraLightsBlack(); } else { if (iel == _first) { _first = iel.next; } if (iel == _last) { _last = iel.prev; } } }
//============================================================ public static void AddList(EchoLight iel) { if (iel.inList) { return; } if (_first == null) { _first = iel; _last = iel; _last.next = null; } else { _last.next = iel; iel.prev = _last; _last = iel; _last.next = null; } _use4ExtraPoint = true; iel.inList = true; }
//============================================================ bool InitLights() { Light light; EchoLight el; if (_cameraTransform == null && Camera.main != null) { _cameraTransform = Camera.main.transform; } if (_found == null) { _found = new EchoLight[4]; } _lights = UnityEngine.Object.FindObjectsOfType(typeof(Light)) as Light[]; _mainPointLight = null; _mainDirLight = null; _useLights = false; _use4ExtraPoint = false; _extraLights = null; _first = null; _last = null; _use4ExtraPoint = false; _last = null; _first = null; Set4ExtraLightsBlack(); if (_extraLights == null) { _extraLights = new EchoLight[4]; } if (MainDirLight || MainPointLight || FourPointLights) { _useLights = true; } else { return(false); } // loop thru unity lights and turn them info EchoLights if (_lights != null && _lights.Length > 0) { for (int loop = 0; loop < _lights.Length; loop++) { light = _lights[loop]; // SCOTTFIND this may be unity 4.2 only #if !UNITY_3_5 #if !UNITY_4_1 if (light.alreadyLightmapped) { continue; } #endif #endif if (light.renderMode != LightRenderMode.ForceVertex || (_lights.Length <= 2 && FourPointLights == false)) { if (light.type == LightType.Point) { _mainPointLight = light.gameObject.GetComponent <EchoLight>(); if (_mainPointLight == null) { _mainPointLight = light.gameObject.AddComponent <EchoLight>(); } _mainPointLight.Init(); } else { _mainDirLight = light.gameObject.GetComponent <EchoLight>(); if (_mainDirLight == null) { _mainDirLight = light.gameObject.AddComponent <EchoLight>(); } _mainDirLight.Init(); } } else { el = light.gameObject.GetComponent <EchoLight>(); if (el == null) { el = light.gameObject.AddComponent <EchoLight>(); } el.inList = false; el.Init(); } } } return(true); }