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 = []

View File

@@ -2,8 +2,12 @@ from observable import Observable
from collections import defaultdict
import logging
import time
class Target(Observable):
lastActivation = 0
def __init__(self, points, name):
logging.info("Target " + name + " created")
self._events = defaultdict(list)

View File

@@ -20,6 +20,7 @@ class EndBallEvent(Event):
def trigger(self, target):
super().trigger(target)
TopFlipper().deactivate()
MainFlipper().deactivate()