/// <summary> /// Adds the type of the lights by. /// </summary> /// <param name="tLight">T light.</param> /// <param name="lightType">Light type.</param> /// <param name="amount">Amount.</param> void AddLightsByType(TSTrafficLight tLight, TSTrafficLight.LightType lightType, int amount) { TSTrafficLight.TSLight clone = null; for (int i = 0; i < tLight.lights.Count; i++) { if (tLight.lights[i].lightType == lightType) { clone = tLight.lights[i]; } } for (int i = 0; i < amount; i++) { AddeNewLight(ref tLight); tLight.lights[tLight.lights.Count - 1].lightType = lightType; if (clone != null) { tLight.lights[tLight.lights.Count - 1].enableDisableRenderer = clone.enableDisableRenderer; tLight.lights[tLight.lights.Count - 1].lightGameObject = clone.lightGameObject; tLight.lights[tLight.lights.Count - 1].lightMeshRenderer = clone.lightMeshRenderer; tLight.lights[tLight.lights.Count - 1].lightTexture = clone.lightTexture; tLight.lights[tLight.lights.Count - 1].shaderTexturePropertyName = clone.shaderTexturePropertyName; } } }
/// <summary> /// Removes the type of the lights by. /// </summary> /// <param name="tLight">T light.</param> /// <param name="lightType">Light type.</param> /// <param name="amount">Amount.</param> void RemoveLightsByType(TSTrafficLight tLight, TSTrafficLight.LightType lightType, int amount) { int result = 0; TSTrafficLight.TSLight light = null; for (int i = 0; i < tLight.lights.Count; i++) { light = tLight.lights[i]; if (result == amount) { break; } if (light.lightType == lightType) { tLight.lights.Remove(light); } result++; } }