added vizualization for violations

This commit is contained in:
romue
2021-05-18 14:22:22 +02:00
parent 5a6a444af4
commit a6793e11ca
3 changed files with 17 additions and 6 deletions

View File

@@ -41,9 +41,9 @@ class Renderer:
rect = pygame.Rect(x, y, self.cell_size, self.cell_size)
pygame.draw.rect(self.screen, Renderer.WHITE, rect, 1)
def blit_params(self, entity, name):
def blit_params(self, entity):
r, c = entity.pos
img = self.assets[name]
img = self.assets[entity.name]
if entity.value_operation == 'opacity':
img.set_alpha(255*entity.value)
elif entity.value_operation == 'scale':
@@ -71,7 +71,7 @@ class Renderer:
self.fill_bg()
for asset, entities in pos_dict.items():
for entity in entities:
bp = self.blit_params(entity, asset)
bp = self.blit_params(entity)
if 'agent' in asset and self.view_radius > 0:
visibility_rect = bp['dest'].inflate((self.view_radius*2)*self.cell_size, (self.view_radius*2)*self.cell_size)
shape_surf = pygame.Surface(visibility_rect.size, pygame.SRCALPHA)