//Setup all the touch down zone lights. private void SetupTDZLights(ref List <SpriteLights.LightData> lightData, ApproachLightData allApproachLightData, RunwayData runwayData, bool randomBrightness, float brightness, float size) { for (int side = 0; side < 2; side++) { if (runwayData.lightingType[side] != LightingType.NONE) { SvgData[] svgData = allApproachLightData.GetApproachLightData(runwayData.lightingType[side]); //Set TDZ lights. if (runwayData.TDZ[side]) { svgData = allApproachLightData.GetApproachLightData(LightingType.TDZ); for (int i = 0; i < svgData.Length; i++) { if (svgData[i].materialString == whiteDirectionalSinglesideCString) { SpriteLights.LightData data = new SpriteLights.LightData(); Vector3 position = (runwayData.rotation[side] * svgData[i].position) + runwayData.thresholdPosition[side]; data.frontColor = whiteLight; data.brightness = SetBrightness(randomBrightness, brightness); data.position = position; //Set the direction and upward rotation of the light. data.rotation = runwayData.rotation[side] * Quaternion.Euler(Vector3.right * runwayData.lightAngle); data.size = size; lightData.Add(data); } } } } } }
//Setup all the touch down zone lights. private void SetupTDZLights(ref List<SpriteLights.LightData> lightData, ApproachLightData allApproachLightData, RunwayData runwayData, bool randomBrightness, float brightness, float size){ for(int side = 0; side < 2; side++){ if(runwayData.lightingType[side] != LightingType.NONE){ SvgData[] svgData = allApproachLightData.GetApproachLightData(runwayData.lightingType[side]); //Set TDZ lights. if(runwayData.TDZ[side]){ svgData = allApproachLightData.GetApproachLightData(LightingType.TDZ); for(int i = 0; i < svgData.Length; i++){ if(svgData[i].materialString == whiteDirectionalSinglesideCString){ SpriteLights.LightData data = new SpriteLights.LightData(); Vector3 position = (runwayData.rotation[side] * svgData[i].position) + runwayData.thresholdPosition[side]; data.frontColor = whiteLight; data.brightness = SetBrightness(randomBrightness, brightness); data.position = position; //Set the direction and upward rotation of the light. data.rotation = runwayData.rotation[side] * Quaternion.Euler(Vector3.right * runwayData.lightAngle); data.size = size; lightData.Add(data); } } } } } }
//Setup all the strobe lights. private void SetupStrobeLights(ref List <SpriteLights.LightData> lightData, ApproachLightData allApproachLightData, RunwayData runwayData, float strobeTimeStep) { float groupID = Random.Range(0.0f, 0.99f); for (int side = 0; side < 2; side++) { if (runwayData.lightingType[side] != LightingType.NONE) { SvgData[] svgData = allApproachLightData.GetApproachLightData(runwayData.lightingType[side]); if ((runwayData.strobeType[side] == StrobeType.ODALS) || (runwayData.strobeType[side] == StrobeType.BOTH)) { for (int i = 0; i < svgData.Length; i++) { SpriteLights.LightData data = new SpriteLights.LightData(); Vector3 position = (runwayData.rotation[side] * svgData[i].position) + runwayData.thresholdPosition[side]; if (svgData[i].materialString == strobeCString) { data.position = position; //Set the direction and upward rotation of the light. data.rotation = runwayData.rotation[side] * Quaternion.Euler(Vector3.right * runwayData.lightAngle); data.strobeID = svgData[i].id * strobeTimeStep; data.strobeGroupID = groupID; lightData.Add(data); } } } if ((runwayData.strobeType[side] == StrobeType.REIL) || (runwayData.strobeType[side] == StrobeType.BOTH)) { float distanceOffset = 0; Vector3 sideOffsetDir = Math3d.GetRightVector(runwayData.rotation[side]); //If threshold wing bars are used, the REIL distance must be bigger, otherwise they overlap. if (runwayData.thresholdWingbar[side] == ThresholdWingbar.LARGE) { distanceOffset = 15.5f; } if ((runwayData.thresholdWingbar[side] == ThresholdWingbar.SMALL) || (runwayData.thresholdWingbar[side] == ThresholdWingbar.NONE)) { distanceOffset = 12f; } //Right strobe. Vector3 startOffsetAVec = Math3d.SetVectorLength(sideOffsetDir, (runwayData.width * 0.5f) + distanceOffset); Vector3 position = runwayData.thresholdPosition[side] + startOffsetAVec; SpriteLights.LightData data = new SpriteLights.LightData(); data.position = position; //Set the direction and upward rotation of the light. data.rotation = runwayData.rotation[side] * Quaternion.Euler(Vector3.right * runwayData.lightAngle); //The strobe ID is 0, so it will flash at the same time as all other strobes with ID 0. //The group ID is the same as the walking strobe, so it is synchronized with that. data.strobeID = 0; data.strobeGroupID = groupID; lightData.Add(data); //Left strobe. position = runwayData.thresholdPosition[side] - startOffsetAVec; data = new SpriteLights.LightData(); data.position = position; //Set the direction and upward rotation of the light. data.rotation = runwayData.rotation[side] * Quaternion.Euler(Vector3.right * runwayData.lightAngle); data.strobeGroupID = groupID; lightData.Add(data); } } } }
//Setup all the strobe lights. private void SetupStrobeLights(ref List<SpriteLights.LightData> lightData, ApproachLightData allApproachLightData, RunwayData runwayData, float strobeTimeStep){ float groupID = Random.Range(0.0f, 0.99f); for(int side = 0; side < 2; side++){ if(runwayData.lightingType[side] != LightingType.NONE){ SvgData[] svgData = allApproachLightData.GetApproachLightData(runwayData.lightingType[side]); if((runwayData.strobeType[side] == StrobeType.ODALS) || (runwayData.strobeType[side] == StrobeType.BOTH)){ for(int i = 0; i < svgData.Length; i++){ SpriteLights.LightData data = new SpriteLights.LightData(); Vector3 position = (runwayData.rotation[side] * svgData[i].position) + runwayData.thresholdPosition[side]; if(svgData[i].materialString == strobeCString){ data.position = position; //Set the direction and upward rotation of the light. data.rotation = runwayData.rotation[side] * Quaternion.Euler(Vector3.right * runwayData.lightAngle); data.strobeID = svgData[i].id * strobeTimeStep; data.strobeGroupID = groupID; lightData.Add(data); } } } if((runwayData.strobeType[side] == StrobeType.REIL) || (runwayData.strobeType[side] == StrobeType.BOTH)){ float distanceOffset = 0; Vector3 sideOffsetDir = Math3d.GetRightVector(runwayData.rotation[side]); //If threshold wing bars are used, the REIL distance must be bigger, otherwise they overlap. if(runwayData.thresholdWingbar[side] == ThresholdWingbar.LARGE){ distanceOffset = 15.5f; } if((runwayData.thresholdWingbar[side] == ThresholdWingbar.SMALL) || (runwayData.thresholdWingbar[side] == ThresholdWingbar.NONE)){ distanceOffset = 12f; } //Right strobe. Vector3 startOffsetAVec = Math3d.SetVectorLength(sideOffsetDir, (runwayData.width * 0.5f) + distanceOffset); Vector3 position = runwayData.thresholdPosition[side] + startOffsetAVec; SpriteLights.LightData data = new SpriteLights.LightData(); data.position = position; //Set the direction and upward rotation of the light. data.rotation = runwayData.rotation[side] * Quaternion.Euler(Vector3.right * runwayData.lightAngle); //The strobe ID is 0, so it will flash at the same time as all other strobes with ID 0. //The group ID is the same as the walking strobe, so it is synchronized with that. data.strobeID = 0; data.strobeGroupID = groupID; lightData.Add(data); //Left strobe. position = runwayData.thresholdPosition[side] - startOffsetAVec; data = new SpriteLights.LightData(); data.position = position; //Set the direction and upward rotation of the light. data.rotation = runwayData.rotation[side] * Quaternion.Euler(Vector3.right * runwayData.lightAngle); data.strobeGroupID = groupID; lightData.Add(data); } } } }