private bool LeftArrowLightMode(int segmentId, float lightWidth, bool hasRightSegment, bool hasForwardSegment, Vector3 screenPos, float pedestrianWidth, float zoom, float lightHeight, ICustomSegmentLight 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, TextureResources.GreenLightLeftTexture2D); break; case RoadBaseAI.TrafficLightState.Red: GUI.DrawTexture(myRect4, TextureResources.RedLightLeftTexture2D); break; } if (!myRect4.Contains(Event.current.mousePosition)) { return(hoveredSegment); } _hoveredButton[0] = segmentId; _hoveredButton[1] = 3; if (!MainTool.CheckClicked()) { return(true); } segmentDict.ChangeLeftLight(); if (!hasForwardSegment) { segmentDict.ChangeMainLight(); } return(true); }
private bool LeftForwardRManualSegmentLightMode(bool hasLeftSegment, int segmentId, Vector3 screenPos, float lightWidth, float pedestrianWidth, float zoom, float lightHeight, ICustomSegmentLight 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, TrafficLightTextures.GreenLightLeft); break; } case RoadBaseAI.TrafficLightState.Red: { GUI.DrawTexture(myRect4, TrafficLightTextures.RedLightLeft); break; } } if (myRect4.Contains(Event.current.mousePosition)) { hoveredButton[0] = segmentId; hoveredButton[1] = 3; hoveredSegment = true; if (MainTool.CheckClicked()) { segmentDict.ChangeLeftLight(); } } } // 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, TrafficLightTextures.GreenLightForwardRight); break; } case RoadBaseAI.TrafficLightState.Red: { GUI.DrawTexture(myRect5, TrafficLightTextures.RedLightForwardRight); break; } } } else if (!hasRightSegment) { switch (segmentDict.LightMain) { case RoadBaseAI.TrafficLightState.Green: { GUI.DrawTexture(myRect5, TrafficLightTextures.GreenLightStraight); break; } case RoadBaseAI.TrafficLightState.Red: { GUI.DrawTexture(myRect5, TrafficLightTextures.RedLightStraight); break; } } } else { switch (segmentDict.LightMain) { case RoadBaseAI.TrafficLightState.Green: { GUI.DrawTexture(myRect5, TrafficLightTextures.GreenLightRight); break; } case RoadBaseAI.TrafficLightState.Red: { GUI.DrawTexture(myRect5, TrafficLightTextures.RedLightRight); break; } } } if (!myRect5.Contains(Event.current.mousePosition)) { return(hoveredSegment); } hoveredButton[0] = segmentId; hoveredButton[1] = 4; if (!MainTool.CheckClicked()) { return(true); } segmentDict.ChangeMainLight(); return(true); }