(self, surface, list_tl, world_to_pixel)
| 1007 | return (vehicles, traffic_lights, speed_limits, walkers) |
| 1008 | |
| 1009 | def _render_traffic_lights(self, surface, list_tl, world_to_pixel): |
| 1010 | self.affected_traffic_light = None |
| 1011 | |
| 1012 | for tl in list_tl: |
| 1013 | world_pos = tl.get_location() |
| 1014 | pos = world_to_pixel(world_pos) |
| 1015 | |
| 1016 | if self.args.show_triggers: |
| 1017 | corners = Util.get_bounding_box(tl) |
| 1018 | corners = [world_to_pixel(p) for p in corners] |
| 1019 | pygame.draw.lines(surface, COLOR_BUTTER_1, True, corners, 2) |
| 1020 | |
| 1021 | if self.hero_actor is not None: |
| 1022 | corners = Util.get_bounding_box(tl) |
| 1023 | corners = [world_to_pixel(p) for p in corners] |
| 1024 | tl_t = tl.get_transform() |
| 1025 | |
| 1026 | transformed_tv = tl_t.transform(tl.trigger_volume.location) |
| 1027 | hero_location = self.hero_actor.get_location() |
| 1028 | d = hero_location.distance(transformed_tv) |
| 1029 | s = Util.length(tl.trigger_volume.extent) + Util.length(self.hero_actor.bounding_box.extent) |
| 1030 | if (d <= s): |
| 1031 | # Highlight traffic light |
| 1032 | self.affected_traffic_light = tl |
| 1033 | srf = self.traffic_light_surfaces.surfaces['h'] |
| 1034 | surface.blit(srf, srf.get_rect(center=pos)) |
| 1035 | |
| 1036 | srf = self.traffic_light_surfaces.surfaces[tl.state] |
| 1037 | surface.blit(srf, srf.get_rect(center=pos)) |
| 1038 | |
| 1039 | def _render_speed_limits(self, surface, list_sl, world_to_pixel, world_to_pixel_width): |
| 1040 |
no test coverage detected