ChangeLightMain() public method

public ChangeLightMain ( ) : void
return void
        private bool LeftForwardRManualSegmentLightMode(bool hasLeftSegment, int segmentId, Vector3 screenPos, float lightWidth,
            float pedestrianWidth, float zoom, float lightHeight, ManualSegmentLight segmentDict, bool hoveredSegment,
            bool hasForwardSegment, bool hasRightSegment)
        {
            if (hasLeftSegment)
            {
                // left arrow light
                SetAlpha(segmentId, 3);

                var myRect4 =
                    new Rect(screenPos.x - lightWidth/2 - lightWidth*2 - pedestrianWidth + 5f*zoom,
                        screenPos.y - lightHeight/2, lightWidth, lightHeight);

                switch (segmentDict.LightLeft)
                {
                    case RoadBaseAI.TrafficLightState.Green:
                        GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.GreenLightLeftTexture2D);
                        break;
                    case RoadBaseAI.TrafficLightState.Red:
                        GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.RedLightLeftTexture2D);
                        break;
                }

                if (myRect4.Contains(Event.current.mousePosition))
                {
                    _hoveredButton[0] = segmentId;
                    _hoveredButton[1] = 3;
                    hoveredSegment = true;

                    if (Input.GetMouseButtonDown(0) && !_uiClickedSegment)
                    {
                        _uiClickedSegment = true;
                        segmentDict.ChangeLightLeft();
                    }
                }
            }

            // forward-right arrow light
            SetAlpha(segmentId, 4);

            var myRect5 =
                new Rect(screenPos.x - lightWidth/2 - lightWidth - pedestrianWidth + 5f*zoom,
                    screenPos.y - lightHeight/2, lightWidth, lightHeight);

            if (hasForwardSegment && hasRightSegment)
            {
                switch (segmentDict.LightMain)
                {
                    case RoadBaseAI.TrafficLightState.Green:
                        GUI.DrawTexture(myRect5, TrafficLightToolTextureResources.GreenLightForwardRightTexture2D);
                        break;
                    case RoadBaseAI.TrafficLightState.Red:
                        GUI.DrawTexture(myRect5, TrafficLightToolTextureResources.RedLightForwardRightTexture2D);
                        break;
                }
            }
            else if (!hasRightSegment)
            {
                switch (segmentDict.LightMain)
                {
                    case RoadBaseAI.TrafficLightState.Green:
                        GUI.DrawTexture(myRect5, TrafficLightToolTextureResources.GreenLightStraightTexture2D);
                        break;
                    case RoadBaseAI.TrafficLightState.Red:
                        GUI.DrawTexture(myRect5, TrafficLightToolTextureResources.RedLightStraightTexture2D);
                        break;
                }
            }
            else
            {
                switch (segmentDict.LightMain)
                {
                    case RoadBaseAI.TrafficLightState.Green:
                        GUI.DrawTexture(myRect5, TrafficLightToolTextureResources.GreenLightRightTexture2D);
                        break;
                    case RoadBaseAI.TrafficLightState.Red:
                        GUI.DrawTexture(myRect5, TrafficLightToolTextureResources.RedLightRightTexture2D);
                        break;
                }
            }

            if (!myRect5.Contains(Event.current.mousePosition))
                return hoveredSegment;
            _hoveredButton[0] = segmentId;
            _hoveredButton[1] = 4;

            if (!Input.GetMouseButtonDown(0) || _uiClickedSegment)
                return true;
            _uiClickedSegment = true;
            segmentDict.ChangeLightMain();
            return true;
        }
		private bool RightForwardLSegmentLightMode(int segmentId, Vector3 screenPos, float lightWidth, float pedestrianWidth,
			float zoom, float lightHeight, bool hasForwardSegment, bool hasLeftSegment, ManualSegmentLight segmentDict,
			bool hasRightSegment, bool hoveredSegment) {
			SetAlpha(segmentId, 3);

			var myRect4 = new Rect(screenPos.x - lightWidth / 2 - lightWidth * 2 - pedestrianWidth + 5f * zoom,
				screenPos.y - lightHeight / 2, lightWidth, lightHeight);

			if (hasForwardSegment && hasLeftSegment) {
				switch (segmentDict.LightLeft) {
					case RoadBaseAI.TrafficLightState.Green:
						GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.GreenLightForwardLeftTexture2D);
						break;
					case RoadBaseAI.TrafficLightState.Red:
						GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.RedLightForwardLeftTexture2D);
						break;
				}
			} else if (!hasLeftSegment) {
				if (!hasRightSegment) {
					myRect4 = new Rect(screenPos.x - lightWidth / 2 - lightWidth - pedestrianWidth + 5f * zoom,
						screenPos.y - lightHeight / 2, lightWidth, lightHeight);
				}

				switch (segmentDict.LightMain) {
					case RoadBaseAI.TrafficLightState.Green:
						GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.GreenLightStraightTexture2D);
						break;
					case RoadBaseAI.TrafficLightState.Red:
						GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.RedLightStraightTexture2D);
						break;
				}
			} else {
				if (!hasRightSegment) {
					myRect4 = new Rect(screenPos.x - lightWidth / 2 - lightWidth - pedestrianWidth + 5f * zoom,
						screenPos.y - lightHeight / 2, lightWidth, lightHeight);
				}

				switch (segmentDict.LightMain) {
					case RoadBaseAI.TrafficLightState.Green:
						GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.GreenLightLeftTexture2D);
						break;
					case RoadBaseAI.TrafficLightState.Red:
						GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.RedLightLeftTexture2D);
						break;
				}
			}


			if (myRect4.Contains(Event.current.mousePosition)) {
				_hoveredButton[0] = segmentId;
				_hoveredButton[1] = 3;
				hoveredSegment = true;

				if (checkClicked()) {
					segmentDict.ChangeLightMain();
				}
			}

			var guiColor = GUI.color;
			// right arrow light
			if (hasRightSegment)
				guiColor.a = _hoveredButton[0] == segmentId && _hoveredButton[1] == 4 ? 0.92f : 0.6f;

			GUI.color = guiColor;

			var myRect5 =
				new Rect(screenPos.x - lightWidth / 2 - lightWidth - pedestrianWidth + 5f * zoom,
					screenPos.y - lightHeight / 2, lightWidth, lightHeight);

			switch (segmentDict.LightRight) {
				case RoadBaseAI.TrafficLightState.Green:
					GUI.DrawTexture(myRect5, TrafficLightToolTextureResources.GreenLightRightTexture2D);
					break;
				case RoadBaseAI.TrafficLightState.Red:
					GUI.DrawTexture(myRect5, TrafficLightToolTextureResources.RedLightRightTexture2D);
					break;
			}


			if (!myRect5.Contains(Event.current.mousePosition))
				return hoveredSegment;

			_hoveredButton[0] = segmentId;
			_hoveredButton[1] = 4;

			if (!Input.GetMouseButtonDown(0) || mouseClickProcessed)
				return true;
			mouseClickProcessed = true;
			segmentDict.ChangeLightRight();
			return true;
		}
        private bool LeftArrowLightMode(int segmentId, float lightWidth, bool hasRightSegment,
            bool hasForwardSegment, Vector3 screenPos, float pedestrianWidth, float zoom, float lightHeight,
            ManualSegmentLight segmentDict, bool hoveredSegment)
        {
            SetAlpha(segmentId, 3);

            var offsetLight = lightWidth;

            if (hasRightSegment)
                offsetLight += lightWidth;

            if (hasForwardSegment)
                offsetLight += lightWidth;

            var myRect4 =
                new Rect(screenPos.x - lightWidth/2 - offsetLight - pedestrianWidth + 5f*zoom,
                    screenPos.y - lightHeight/2, lightWidth, lightHeight);

            switch (segmentDict.LightLeft)
            {
                case RoadBaseAI.TrafficLightState.Green:
                    GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.GreenLightLeftTexture2D);
                    break;
                case RoadBaseAI.TrafficLightState.Red:
                    GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.RedLightLeftTexture2D);
                    break;
            }

            if (!myRect4.Contains(Event.current.mousePosition))
                return hoveredSegment;
            _hoveredButton[0] = segmentId;
            _hoveredButton[1] = 3;

            if (!Input.GetMouseButtonDown(0) || _uiClickedSegment)
                return true;

            _uiClickedSegment = true;
            segmentDict.ChangeLightLeft();

            if (!hasForwardSegment)
            {
                segmentDict.ChangeLightMain();
            }
            return true;
        }
		private bool SimpleManualSegmentLightMode(int segmentId, Vector3 screenPos, float lightWidth, float pedestrianWidth,
			float zoom, float lightHeight, ManualSegmentLight segmentDict, bool hoveredSegment) {
			SetAlpha(segmentId, 3);

			var myRect4 =
				new Rect(screenPos.x - lightWidth / 2 - lightWidth - pedestrianWidth + 5f * zoom,
					screenPos.y - lightHeight / 2, lightWidth, lightHeight);

			switch (segmentDict.LightMain) {
				case RoadBaseAI.TrafficLightState.Green:
					GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.GreenLightTexture2D);
					break;
				case RoadBaseAI.TrafficLightState.Red:
					GUI.DrawTexture(myRect4, TrafficLightToolTextureResources.RedLightTexture2D);
					break;
			}

			if (!myRect4.Contains(Event.current.mousePosition))
				return hoveredSegment;
			_hoveredButton[0] = segmentId;
			_hoveredButton[1] = 3;

			if (!Input.GetMouseButtonDown(0) || mouseClickProcessed)
				return true;

			mouseClickProcessed = true;
			segmentDict.ChangeLightMain();
			return true;
		}