public GSDTrafficLightSequence(bool bPath1, GSDTrafficLightController.iLightControllerEnum tLightController, GSDTrafficLightController.iLightSubStatusEnum tLightSubcontroller, float xTime)
 {
     bLightMasterPath1   = bPath1;
     iLightController    = tLightController;
     iLightSubcontroller = tLightSubcontroller;
     tTime = xTime;
 }
Ejemplo n.º 2
0
	public GSDTrafficLightSequence(bool bPath1, GSDTrafficLightController.iLightControllerEnum tLightController, GSDTrafficLightController.iLightSubStatusEnum tLightSubcontroller, float xTime){
		bLightMasterPath1 = bPath1;
		iLightController = tLightController;
		iLightSubcontroller = tLightSubcontroller;
		tTime = xTime;
	}
    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));
    }