コード例 #1
0
ファイル: priority_queue.py プロジェクト: Aluriak/TIA
 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)