예제 #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)
예제 #2
0
파일: engine.py 프로젝트: Aluriak/TIA
 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)
예제 #3
0
파일: engine.py 프로젝트: Aluriak/TIA
 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)