Example #1
0
    // Use this for initialization
    void Start()
    {
        _BoxCollider = gameObject.GetComponent <BoxCollider>();
        switch (TrafficSide)
        {
        case TrafficLightSide.LL:
            TrafficLightInfo = RoadIntersection.LightsLL;
            break;

        case TrafficLightSide.RR:
            TrafficLightInfo = RoadIntersection.LightsRR;
            break;

        case TrafficLightSide.RL:
            TrafficLightInfo = RoadIntersection.LightsRL;
            break;

        case TrafficLightSide.LR:
            TrafficLightInfo = RoadIntersection.LightsLR;
            break;
        }
    }
	public GSDTrafficLightSequence(bool bPath1, GSDTrafficLightController.iLightControllerEnum tLightController, GSDTrafficLightController.iLightSubStatusEnum tLightSubcontroller, float xTime){
		bLightMasterPath1 = bPath1;
		iLightController = tLightController;
		iLightSubcontroller = tLightSubcontroller;
		tTime = xTime;
	}
Example #3
0
		private static void ProcessPole(GameObject MasterGameObj, GameObject tObj, Vector3 tan, int tCorner, float InterDist){
			GSDRoadIntersection GSDRI = MasterGameObj.GetComponent<GSDRoadIntersection>();
			GSDSplineC tSpline = GSDRI.Node1.GSDSpline;
//			bool bIsRB = true;
		
//			float RoadWidth = tSpline.tRoad.RoadWidth();
			float LaneWidth = tSpline.tRoad.opt_LaneWidth;
			float ShoulderWidth = tSpline.tRoad.opt_ShoulderWidth;
			
			int Lanes = tSpline.tRoad.opt_Lanes;
			int LanesHalf = Lanes / 2;
			float LanesForInter = -1;
			if(GSDRI.rType == GSDRoadIntersection.RoadTypeEnum.BothTurnLanes){
				LanesForInter = LanesHalf + 1f;
			}else if(GSDRI.rType == GSDRoadIntersection.RoadTypeEnum.TurnLane){
				LanesForInter = LanesHalf + 1f;
			}else{
				LanesForInter = LanesHalf;
			}
			float DistFromCorner = (ShoulderWidth*0.35f);
			float TLDistance = (LanesForInter * LaneWidth) + DistFromCorner;
			
			MeshFilter MF = tObj.GetComponent<MeshFilter>();
			Mesh tMesh = MF.sharedMesh;
			Vector3[] tVerts = tMesh.vertices;
			Vector3 StartVec = tVerts[520];
			Vector3 EndVec = tVerts[521];
			StartVec = (((EndVec-StartVec) * (DistFromCorner/TLDistance)) + StartVec);
			Vector3 tempR_Start = tVerts[399];
			Vector3 tempR_End = tVerts[396];
			Vector3 tLanePosR = ((tempR_End - tempR_Start)*0.95f) + tempR_Start;
			tLanePosR.z -= 1f;
			
			float SmallerDist = Vector3.Distance(StartVec,EndVec);
			
			//StartVec = Corner
			//2.5m = lane
			//7.5m = lane
			//12.5m = lane
			Vector3[] tLanePos = new Vector3[LanesHalf];
			for(int i=0;i<LanesHalf;i++){
				tLanePos[i] = (((EndVec-StartVec) * (((LaneWidth*0.5f)+(i*LaneWidth))/SmallerDist)) + StartVec);
			}
			Vector3 tLanePosL = default(Vector3);
			Vector3 tLanePosL_Sign = default(Vector3);
			
			if(GSDRI.bLeftTurnYieldOnGreen){
				tLanePosL = ((EndVec-StartVec) * ((SmallerDist-1.8f)/SmallerDist)) + StartVec;
				tLanePosL_Sign = ((EndVec-StartVec) * ((SmallerDist-3.2f)/SmallerDist)) + StartVec;
			}else{
				tLanePosL = ((EndVec-StartVec) * ((SmallerDist-2.5f)/SmallerDist)) + StartVec;
			}
			
			Vector3 tPos1 = default(Vector3);
			if(tCorner == 0){ //RR
				tPos1 = GSDRI.CornerLR;
			}else if(tCorner == 1){ //RL
				tPos1 = GSDRI.CornerRR;
			}else if(tCorner == 2){ //LL
				tPos1 = GSDRI.CornerRL;
			}else if(tCorner == 3){ //LR
				tPos1 = GSDRI.CornerLL;
			}
			
			int mCount = tLanePos.Length;
			float mDistance = -50000f;
			float tDistance = 0f;
			for(int i=0;i<mCount;i++){
				tDistance = Vector3.Distance(tObj.transform.TransformPoint(tLanePos[i]),tPos1);
				if(tDistance > mDistance){ mDistance = tDistance; }
			}
			tDistance = Vector3.Distance(tObj.transform.TransformPoint(tLanePosL),tPos1);
			if(tDistance > mDistance){ mDistance = tDistance; }
			tDistance = Vector3.Distance(tObj.transform.TransformPoint(tLanePosR),tPos1);
			if(tDistance > mDistance){ mDistance = tDistance; }
			
			float tScaleSense = ((200f-GSDRI.ScalingSense) / 200f) * 200f;
			tScaleSense = Mathf.Clamp(tScaleSense * 0.1f,0f,20f);
			float ScaleMod = ((mDistance/17f) + tScaleSense) * (1f/(tScaleSense+1f));
			if(IsApproximately(tScaleSense,20f,0.05f)){ ScaleMod = 1f; }
			ScaleMod = Mathf.Clamp(ScaleMod,1f,1.5f);
			Vector3 tScale = new Vector3(ScaleMod,ScaleMod,ScaleMod);
			bool bScale = true; if(IsApproximately(ScaleMod,1f,0.001f)){ bScale = false; }
			
			//Debug.Log (mDistance + " " + ScaleMod + " " + tScaleSense);
			
			GameObject tRight = null;
			GameObject tLeft = null;
			GameObject tLeft_Sign = null;
			Object prefab = null;
			
			MeshRenderer MR_Left = null;
			MeshRenderer MR_Right = null;
			MeshRenderer[] MR_Mains = new MeshRenderer[LanesHalf];
			int cCount = -1;
			if(GSDRI.rType != GSDRoadIntersection.RoadTypeEnum.NoTurnLane){
				if(GSDRI.bLeftTurnYieldOnGreen){
					prefab = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDTrafficLightLeftYield.prefab", typeof(GameObject));
				}else{
					prefab = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDTrafficLightLeft.prefab", typeof(GameObject));
				}
				tLeft = (GameObject)GameObject.Instantiate(prefab,Vector3.zero,Quaternion.identity);
				tLeft.transform.position = tObj.transform.TransformPoint(tLanePosL);
				tLeft.transform.rotation = Quaternion.LookRotation(tan) * Quaternion.Euler(0f,90f,0f);
				tLeft.transform.parent = tObj.transform;
				tLeft.transform.name = "LightLeft";
				
				cCount = tLeft.transform.childCount;
				for(int i=0;i<cCount;i++){
					if(tLeft.transform.GetChild(i).name.ToLower() == "lights"){
						MR_Left = tLeft.transform.GetChild(i).GetComponent<MeshRenderer>();
					}
				}
				
				if(bScale){ tLeft.transform.localScale = tScale; }
				
				if(GSDRI.bLeftTurnYieldOnGreen){
					prefab = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDSignYieldOnGreen.prefab", typeof(GameObject));
					tLeft_Sign = (GameObject)GameObject.Instantiate(prefab,Vector3.zero,Quaternion.identity);
					tLeft_Sign.transform.position = tObj.transform.TransformPoint(tLanePosL_Sign);
					tLeft_Sign.transform.rotation = Quaternion.LookRotation(tan) * Quaternion.Euler(-90f,90f,0f);
					tLeft_Sign.transform.parent = tObj.transform;
					tLeft_Sign.transform.name = "SignYieldOnGreen";
					if(bScale){ tLeft_Sign.transform.localScale = tScale; }
				}
			}
			if(GSDRI.rType == GSDRoadIntersection.RoadTypeEnum.BothTurnLanes){
				prefab = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDTrafficLightRight.prefab", typeof(GameObject));
				tRight = (GameObject)GameObject.Instantiate(prefab,Vector3.zero,Quaternion.identity);
				tRight.transform.position = tObj.transform.TransformPoint(tLanePosR);
				tRight.transform.rotation = Quaternion.LookRotation(tan) * Quaternion.Euler(0f,90f,0f);
				tRight.transform.parent = tObj.transform;
				tRight.transform.name = "LightRight";
				if(bScale){ tRight.transform.localScale = tScale; }
				
				cCount = tRight.transform.childCount;
				for(int i=0;i<cCount;i++){
					if(tRight.transform.GetChild(i).name.ToLower() == "lights"){
						MR_Right = tRight.transform.GetChild(i).GetComponent<MeshRenderer>();
					}
				}
			}
			GameObject[] tLanes = new GameObject[LanesHalf];
			for(int i=0;i<LanesHalf;i++){
				prefab = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDTrafficLightMain.prefab", typeof(GameObject));
				tLanes[i] = (GameObject)GameObject.Instantiate(prefab,Vector3.zero,Quaternion.identity);
				tLanes[i].transform.position = tObj.transform.TransformPoint(tLanePos[i]);
				tLanes[i].transform.rotation = Quaternion.LookRotation(tan) * Quaternion.Euler(0f,90f,0f);
				tLanes[i].transform.parent = tObj.transform;
				tLanes[i].transform.name = "Light" + i.ToString();
				if(bScale){ tLanes[i].transform.localScale = tScale; }
				
				cCount = tLanes[i].transform.childCount;
				for(int j=0;j<cCount;j++){
					if(tLanes[i].transform.GetChild(j).name.ToLower() == "lights"){
						MR_Mains[i] = tLanes[i].transform.GetChild(j).GetComponent<MeshRenderer>();
					}
				}
			}

			GSDTrafficLightController LM = new GSDTrafficLightController(ref tLeft,ref tRight,ref tLanes, ref MR_Left, ref MR_Right, ref MR_Mains);
			if(tCorner == 0){
				GSDRI.LightsRR = null;
				GSDRI.LightsRR = LM;
			}else if(tCorner == 1){
				GSDRI.LightsRL = null;
				GSDRI.LightsRL = LM;
			}else if(tCorner == 2){
				GSDRI.LightsLL = null;
				GSDRI.LightsLL = LM;
			}else if(tCorner == 3){
				GSDRI.LightsLR = null;
				GSDRI.LightsLR = LM;
			}
		}
    private void FixedTime_Increment()
    {
        GSDTrafficLightSequence SMaker = FixedTimeSequenceList[FixedTimeIndex];

        FixedTimeIndex += 1;
        if (FixedTimeIndex > (FixedTimeSequenceList.Count - 1))
        {
            FixedTimeIndex = 0;
        }

        GSDTrafficLightController Lights1 = null;
        GSDTrafficLightController Lights2 = null;

        GSDTrafficLightController Lights_outer1 = null;
        GSDTrafficLightController Lights_outer2 = null;

        if (SMaker.bLightMasterPath1)
        {
            Lights1 = LightsRL;
            Lights2 = LightsLR;

            if (bFlipped)
            {
                Lights_outer1 = LightsRR;
                Lights_outer2 = LightsLL;
            }
            else
            {
                Lights_outer1 = LightsRR;
                Lights_outer2 = LightsLL;
            }
        }
        else
        {
            if (bFlipped)
            {
                Lights1 = LightsRR;
                Lights2 = LightsLL;
            }
            else
            {
                Lights1 = LightsRR;
                Lights2 = LightsLL;
            }

            Lights_outer1 = LightsRL;
            Lights_outer2 = LightsLR;
        }

        GSDTrafficLightController.iLightControllerEnum LCE    = SMaker.iLightController;
        GSDTrafficLightController.iLightSubStatusEnum  LCESub = SMaker.iLightSubcontroller;

        if (LCE == GSDTrafficLightController.iLightControllerEnum.Regular)
        {
            Lights1.UpdateLights(GSDTrafficLightController.iLightStatusEnum.Regular, LCESub, bLightsEnabled);
            Lights2.UpdateLights(GSDTrafficLightController.iLightStatusEnum.Regular, LCESub, bLightsEnabled);
            Lights_outer1.UpdateLights(GSDTrafficLightController.iLightStatusEnum.Red, LCESub, bLightsEnabled);
            Lights_outer2.UpdateLights(GSDTrafficLightController.iLightStatusEnum.Red, LCESub, bLightsEnabled);
        }
        else if (LCE == GSDTrafficLightController.iLightControllerEnum.LeftTurn)
        {
            Lights1.UpdateLights(GSDTrafficLightController.iLightStatusEnum.LeftTurn, LCESub, bLightsEnabled);
            Lights2.UpdateLights(GSDTrafficLightController.iLightStatusEnum.LeftTurn, LCESub, bLightsEnabled);
            Lights_outer1.UpdateLights(GSDTrafficLightController.iLightStatusEnum.RightTurn, LCESub, bLightsEnabled);
            Lights_outer2.UpdateLights(GSDTrafficLightController.iLightStatusEnum.RightTurn, LCESub, bLightsEnabled);
        }
        else if (LCE == GSDTrafficLightController.iLightControllerEnum.Red)
        {
            Lights1.UpdateLights(GSDTrafficLightController.iLightStatusEnum.Red, LCESub, bLightsEnabled);
            Lights2.UpdateLights(GSDTrafficLightController.iLightStatusEnum.Red, LCESub, bLightsEnabled);
            Lights_outer1.UpdateLights(GSDTrafficLightController.iLightStatusEnum.Red, LCESub, bLightsEnabled);
            Lights_outer2.UpdateLights(GSDTrafficLightController.iLightStatusEnum.Red, LCESub, bLightsEnabled);
        }

//		Debug.Log ("Starting: " + SMaker.ToString());
        StartCoroutine(TrafficLightFixedUpdate(SMaker.tTime));
    }
Example #5
0
        private static void ProcessPole(GameObject MasterGameObj, GameObject tObj, Vector3 tan, int tCorner, float InterDist)
        {
            GSDRoadIntersection GSDRI   = MasterGameObj.GetComponent <GSDRoadIntersection>();
            GSDSplineC          tSpline = GSDRI.Node1.GSDSpline;
            //			bool bIsRB = true;

            //			float RoadWidth = tSpline.tRoad.RoadWidth();
            float LaneWidth     = tSpline.tRoad.opt_LaneWidth;
            float ShoulderWidth = tSpline.tRoad.opt_ShoulderWidth;

            int   Lanes         = tSpline.tRoad.opt_Lanes;
            int   LanesHalf     = Lanes / 2;
            float LanesForInter = -1;

            if (GSDRI.rType == GSDRoadIntersection.RoadTypeEnum.BothTurnLanes)
            {
                LanesForInter = LanesHalf + 1f;
            }
            else if (GSDRI.rType == GSDRoadIntersection.RoadTypeEnum.TurnLane)
            {
                LanesForInter = LanesHalf + 1f;
            }
            else
            {
                LanesForInter = LanesHalf;
            }
            float DistFromCorner = (ShoulderWidth * 0.35f);
            float TLDistance     = (LanesForInter * LaneWidth) + DistFromCorner;

            MeshFilter MF    = tObj.GetComponent <MeshFilter>();
            Mesh       tMesh = MF.sharedMesh;

            Vector3[] tVerts   = tMesh.vertices;
            Vector3   StartVec = tVerts[520];
            Vector3   EndVec   = tVerts[521];

            StartVec = (((EndVec - StartVec) * (DistFromCorner / TLDistance)) + StartVec);
            Vector3 tempR_Start = tVerts[399];
            Vector3 tempR_End   = tVerts[396];
            Vector3 tLanePosR   = ((tempR_End - tempR_Start) * 0.95f) + tempR_Start;

            tLanePosR.z -= 1f;

            float SmallerDist = Vector3.Distance(StartVec, EndVec);

            //StartVec = Corner
            //2.5m = lane
            //7.5m = lane
            //12.5m = lane
            Vector3[] tLanePos = new Vector3[LanesHalf];
            for (int i = 0; i < LanesHalf; i++)
            {
                tLanePos[i] = (((EndVec - StartVec) * (((LaneWidth * 0.5f) + (i * LaneWidth)) / SmallerDist)) + StartVec);
            }
            Vector3 tLanePosL      = default;
            Vector3 tLanePosL_Sign = default;

            if (GSDRI.bLeftTurnYieldOnGreen)
            {
                tLanePosL      = ((EndVec - StartVec) * ((SmallerDist - 1.8f) / SmallerDist)) + StartVec;
                tLanePosL_Sign = ((EndVec - StartVec) * ((SmallerDist - 3.2f) / SmallerDist)) + StartVec;
            }
            else
            {
                tLanePosL = ((EndVec - StartVec) * ((SmallerDist - 2.5f) / SmallerDist)) + StartVec;
            }

            Vector3 tPos1 = default;

            if (tCorner == 0)
            { //RR
                tPos1 = GSDRI.CornerLR;
            }
            else if (tCorner == 1)
            { //RL
                tPos1 = GSDRI.CornerRR;
            }
            else if (tCorner == 2)
            { //LL
                tPos1 = GSDRI.CornerRL;
            }
            else if (tCorner == 3)
            { //LR
                tPos1 = GSDRI.CornerLL;
            }

            int   mCount    = tLanePos.Length;
            float mDistance = -50000f;
            float tDistance = 0f;

            for (int i = 0; i < mCount; i++)
            {
                tDistance = Vector3.Distance(tObj.transform.TransformPoint(tLanePos[i]), tPos1);
                if (tDistance > mDistance)
                {
                    mDistance = tDistance;
                }
            }
            tDistance = Vector3.Distance(tObj.transform.TransformPoint(tLanePosL), tPos1);
            if (tDistance > mDistance)
            {
                mDistance = tDistance;
            }
            tDistance = Vector3.Distance(tObj.transform.TransformPoint(tLanePosR), tPos1);
            if (tDistance > mDistance)
            {
                mDistance = tDistance;
            }

            float tScaleSense = ((200f - GSDRI.ScalingSense) / 200f) * 200f;

            tScaleSense = Mathf.Clamp(tScaleSense * 0.1f, 0f, 20f);
            float ScaleMod = ((mDistance / 17f) + tScaleSense) * (1f / (tScaleSense + 1f));

            if (IsApproximately(tScaleSense, 20f, 0.05f))
            {
                ScaleMod = 1f;
            }
            ScaleMod = Mathf.Clamp(ScaleMod, 1f, 1.5f);
            Vector3 tScale = new Vector3(ScaleMod, ScaleMod, ScaleMod);
            bool    bScale = true; if (IsApproximately(ScaleMod, 1f, 0.001f))
            {
                bScale = false;
            }

            //Debug.Log (mDistance + " " + ScaleMod + " " + tScaleSense);

            GameObject tRight     = null;
            GameObject tLeft      = null;
            GameObject tLeft_Sign = null;
            Object     prefab     = null;

            MeshRenderer MR_Left  = null;
            MeshRenderer MR_Right = null;

            MeshRenderer[] MR_Mains = new MeshRenderer[LanesHalf];
            int            cCount   = -1;

            if (GSDRI.rType != GSDRoadIntersection.RoadTypeEnum.NoTurnLane)
            {
                if (GSDRI.bLeftTurnYieldOnGreen)
                {
                    prefab = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDTrafficLightLeftYield.prefab", typeof(GameObject));
                }
                else
                {
                    prefab = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDTrafficLightLeft.prefab", typeof(GameObject));
                }
                tLeft = (GameObject)GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity);
                tLeft.transform.position = tObj.transform.TransformPoint(tLanePosL);
                tLeft.transform.rotation = Quaternion.LookRotation(tan) * Quaternion.Euler(0f, 90f, 0f);
                tLeft.transform.parent   = tObj.transform;
                tLeft.transform.name     = "LightLeft";

                cCount = tLeft.transform.childCount;
                for (int i = 0; i < cCount; i++)
                {
                    if (tLeft.transform.GetChild(i).name.ToLower() == "lights")
                    {
                        MR_Left = tLeft.transform.GetChild(i).GetComponent <MeshRenderer>();
                    }
                }

                if (bScale)
                {
                    tLeft.transform.localScale = tScale;
                }

                if (GSDRI.bLeftTurnYieldOnGreen)
                {
                    prefab     = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDSignYieldOnGreen.prefab", typeof(GameObject));
                    tLeft_Sign = (GameObject)GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity);
                    tLeft_Sign.transform.position = tObj.transform.TransformPoint(tLanePosL_Sign);
                    tLeft_Sign.transform.rotation = Quaternion.LookRotation(tan) * Quaternion.Euler(-90f, 90f, 0f);
                    tLeft_Sign.transform.parent   = tObj.transform;
                    tLeft_Sign.transform.name     = "SignYieldOnGreen";
                    if (bScale)
                    {
                        tLeft_Sign.transform.localScale = tScale;
                    }
                }
            }
            if (GSDRI.rType == GSDRoadIntersection.RoadTypeEnum.BothTurnLanes)
            {
                prefab = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDTrafficLightRight.prefab", typeof(GameObject));
                tRight = (GameObject)GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity);
                tRight.transform.position = tObj.transform.TransformPoint(tLanePosR);
                tRight.transform.rotation = Quaternion.LookRotation(tan) * Quaternion.Euler(0f, 90f, 0f);
                tRight.transform.parent   = tObj.transform;
                tRight.transform.name     = "LightRight";
                if (bScale)
                {
                    tRight.transform.localScale = tScale;
                }

                cCount = tRight.transform.childCount;
                for (int i = 0; i < cCount; i++)
                {
                    if (tRight.transform.GetChild(i).name.ToLower() == "lights")
                    {
                        MR_Right = tRight.transform.GetChild(i).GetComponent <MeshRenderer>();
                    }
                }
            }
            GameObject[] tLanes = new GameObject[LanesHalf];
            for (int i = 0; i < LanesHalf; i++)
            {
                prefab    = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/RoadArchitect/Mesh/RoadObj/Signs/GSDTrafficLightMain.prefab", typeof(GameObject));
                tLanes[i] = (GameObject)GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity);
                tLanes[i].transform.position = tObj.transform.TransformPoint(tLanePos[i]);
                tLanes[i].transform.rotation = Quaternion.LookRotation(tan) * Quaternion.Euler(0f, 90f, 0f);
                tLanes[i].transform.parent   = tObj.transform;
                tLanes[i].transform.name     = "Light" + i.ToString();
                if (bScale)
                {
                    tLanes[i].transform.localScale = tScale;
                }

                cCount = tLanes[i].transform.childCount;
                for (int j = 0; j < cCount; j++)
                {
                    if (tLanes[i].transform.GetChild(j).name.ToLower() == "lights")
                    {
                        MR_Mains[i] = tLanes[i].transform.GetChild(j).GetComponent <MeshRenderer>();
                    }
                }
            }

            GSDTrafficLightController LM = new GSDTrafficLightController(ref tLeft, ref tRight, ref tLanes, ref MR_Left, ref MR_Right, ref MR_Mains);

            if (tCorner == 0)
            {
                GSDRI.LightsRR = null;
                GSDRI.LightsRR = LM;
            }
            else if (tCorner == 1)
            {
                GSDRI.LightsRL = null;
                GSDRI.LightsRL = LM;
            }
            else if (tCorner == 2)
            {
                GSDRI.LightsLL = null;
                GSDRI.LightsLL = LM;
            }
            else if (tCorner == 3)
            {
                GSDRI.LightsLR = null;
                GSDRI.LightsLR = LM;
            }
        }