|
@@ -1,9 +1,8 @@
|
1
|
1
|
from intelligine.core.exceptions import NoPheromone
|
2
|
2
|
from xyzworld.display.Pygame import Pygame as XyzPygame
|
3
|
3
|
import pygame
|
4
|
|
-from intelligine.cst import PHEROMON_INFOS, PHEROMON_DIRECTION, PHEROMON_DIR_HOME, PHEROMON_DIR_EXPLO, PHEROMON_POSITIONS
|
5
|
|
-from intelligine.synergy.object.ant.PheromonExploration import PheromonExploration
|
6
|
|
-from intelligine.synergy.object.ant.PheromonHome import PheromonHome
|
|
4
|
+from intelligine.cst import PHEROMON_DIRECTION, PHEROMON_DIR_HOME, PHEROMON_DIR_EXPLO, PHEROMON_POSITIONS
|
|
5
|
+from intelligine.display.pygame.visualisation import SURFACE_PHEROMONE_EXPLORATION, SURFACE_PHEROMONE_HOME
|
7
|
6
|
|
8
|
7
|
|
9
|
8
|
class Pygame(XyzPygame):
|
|
@@ -18,23 +17,22 @@ class Pygame(XyzPygame):
|
18
|
17
|
self._display_pheromones(context.metas.list.get(PHEROMON_POSITIONS, PHEROMON_POSITIONS, allow_empty=True), context)
|
19
|
18
|
|
20
|
19
|
def _display_pheromones(self, pheromones_positions, context):
|
21
|
|
- # TODO: Code de test bordelique !
|
|
20
|
+ pheromone_exploration_surface = self._object_visualizer.get_surface(SURFACE_PHEROMONE_EXPLORATION)
|
|
21
|
+ pheromone_home_surface = self._object_visualizer.get_surface(SURFACE_PHEROMONE_HOME)
|
|
22
|
+
|
22
|
23
|
for point in pheromones_positions:
|
23
|
|
- flavour = context.pheromones().get_flavour(point)
|
|
24
|
+ point_flavour = context.pheromones().get_flavour(point)
|
24
|
25
|
try:
|
25
|
|
- flavour.get_pheromone(category=PHEROMON_DIRECTION, type=PHEROMON_DIR_HOME)
|
26
|
|
- pheromon = PheromonHome(object(), context)
|
27
|
|
- pheromon.set_direction(11) # TODO: plus de direction avec ces nlles pheromones
|
28
|
|
- self._draw_objects_with_decal(point, [pheromon])
|
|
26
|
+ point_flavour.get_pheromone(category=PHEROMON_DIRECTION, type=PHEROMON_DIR_HOME)
|
|
27
|
+ self.draw_surface(point, pheromone_home_surface)
|
29
|
28
|
except NoPheromone:
|
30
|
|
- pass
|
|
29
|
+ pass # No pheromone here
|
|
30
|
+
|
31
|
31
|
try:
|
32
|
|
- flavour.get_pheromone(category=PHEROMON_DIRECTION, type=PHEROMON_DIR_EXPLO)
|
33
|
|
- pheromon = PheromonExploration(object(), context)
|
34
|
|
- pheromon.set_direction(11) # TODO: plus de direction avec ces nlles pheromones
|
35
|
|
- self._draw_objects_with_decal(point, [pheromon])
|
|
32
|
+ point_flavour.get_pheromone(category=PHEROMON_DIRECTION, type=PHEROMON_DIR_EXPLO)
|
|
33
|
+ self.draw_surface(point, pheromone_exploration_surface)
|
36
|
34
|
except NoPheromone:
|
37
|
|
- pass
|
|
35
|
+ pass # No pheromone here
|
38
|
36
|
|
39
|
37
|
def _key_pressed(self, key):
|
40
|
38
|
if key == pygame.K_p:
|