This commit is contained in:
Jonas Zeunert
2022-09-01 00:07:16 +02:00
parent bb12a2da17
commit ffdd522c7b
3 changed files with 9 additions and 2 deletions

View File

@@ -48,9 +48,11 @@ class GameState:
self.isPlaying = False
self.isStarted = False
logging.info("Game ended")
self.startIdleLoop()
def startIdleLoop(self):
logging.info("Starting Idle Loop")
PLAYER_LAMPS.deactivate()
self.isIdle = True
self.idleThread = threading.Thread(target=self.idleLoop)
self.idleThread.start()
@@ -76,6 +78,8 @@ class GameState:
for _ in range(20):
random_group = random.choice(all_cabinet_lamps)
random_group.toggleRandom(0.2)
if not self.isIdle:
return
for lamps in all_cabinet_lamps:
for lamp in lamps.lamps:
lamp.activate()
@@ -83,8 +87,6 @@ class GameState:
return
time.sleep(0.1)
self.deactivate_all()
if not self.isIdle:
return
def createPlayers(self, playerCount):
players = []