Ejemplo n.º 1
0
 def wait_and_execute_next(self):
     """Execute next command on target iff command execution time is coming. Wait for it if necessary.
     """
     command = self.get(block=True)
     while not command.is_executable:
         self.put(command)
         time.sleep(0.01)
         command = self.get(block=True)
     command.execute(self.target)
Ejemplo n.º 2
0
 def run(self):
     """Game loop implementation"""
     LOGGER.info('Engine: thread started')
     while not self.terminated:
         # collect actions from each agent
         if not time.is_pause():
             for agent in self.agents:
                 agent.update(self)
         # invoke actions from each agent
         self.invoker.execute_next()
         # dirty sleep avoiding a too quick game
         time.sleep(0.1)
Ejemplo n.º 3
0
 def run(self):
     """Game loop implementation"""
     LOGGER.info('Engine: thread started')
     while not self.terminated:
         # collect actions from each agent
         if not time.is_pause():
             for agent in self.agents:
                 agent.update(self)
         # invoke actions from each agent
         self.invoker.execute_next()
         # dirty sleep avoiding a too quick game
         time.sleep(0.1)