blaa
This commit is contained in:
20
GameState.py
20
GameState.py
@@ -49,21 +49,29 @@ class GameState:
|
|||||||
|
|
||||||
def stopIdleLoop(self):
|
def stopIdleLoop(self):
|
||||||
self.isIdle.set()
|
self.isIdle.set()
|
||||||
|
self.deactivate_all()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def deactivate_all(self):
|
||||||
|
all_cabinet_lamps = [BONUS_LAMPS, BONUS_MULTIPLIER_LAMPS, CHAMP_LAMPS,
|
||||||
|
UPPER_PLAYFIELD_TIME_LAMPS, TUNNEL_NUMBER_LAMPS,
|
||||||
|
TUNNEL_LAMPS, TUNNEL_SCORE_LAMPS]
|
||||||
|
for lamp_group in all_cabinet_lamps:
|
||||||
|
lamp_group.deactivate()
|
||||||
|
|
||||||
async def idleLoop(self):
|
async def idleLoop(self):
|
||||||
all_cabinet_lamps = [BONUS_LAMPS, BONUS_MULTIPLIER_LAMPS, CHAMP_LAMPS,
|
all_cabinet_lamps = [BONUS_LAMPS, BONUS_MULTIPLIER_LAMPS, CHAMP_LAMPS,
|
||||||
UPPER_PLAYFIELD_TIME_LAMPS, TUNNEL_NUMBER_LAMPS,
|
UPPER_PLAYFIELD_TIME_LAMPS, TUNNEL_NUMBER_LAMPS,
|
||||||
TUNNEL_LAMPS, TUNNEL_SCORE_LAMPS]
|
TUNNEL_LAMPS, TUNNEL_SCORE_LAMPS]
|
||||||
while True:
|
while True:
|
||||||
#for lamps in all_cabinet_lamps:
|
|
||||||
#for _ in lamps.lamps:
|
|
||||||
#lamps.cycle()
|
|
||||||
#if not self.isIdle:
|
|
||||||
# return
|
|
||||||
#time.sleep(0.1)
|
|
||||||
random_group = random.choice(all_cabinet_lamps)
|
random_group = random.choice(all_cabinet_lamps)
|
||||||
random_group.toggleRandom(0.2)
|
random_group.toggleRandom(0.2)
|
||||||
|
for lamps in all_cabinet_lamps:
|
||||||
|
for _ in lamps.lamps:
|
||||||
|
lamps.cycle()
|
||||||
|
if self.isIdle.is_set():
|
||||||
|
return
|
||||||
|
time.sleep(0.05)
|
||||||
if self.isIdle.is_set():
|
if self.isIdle.is_set():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,12 @@ class LampGroup:
|
|||||||
def toggleRandom(self, sleepTime):
|
def toggleRandom(self, sleepTime):
|
||||||
count = random.randint(1,3)
|
count = random.randint(1,3)
|
||||||
random_lamps = random.choices(self.lamps, k=count)
|
random_lamps = random.choices(self.lamps, k=count)
|
||||||
|
|
||||||
for lamp in random_lamps:
|
for lamp in random_lamps:
|
||||||
lamp.activate()
|
lamp.activate()
|
||||||
|
|
||||||
time.sleep(sleepTime)
|
time.sleep(sleepTime)
|
||||||
|
|
||||||
for lamp in random_lamps:
|
for lamp in random_lamps:
|
||||||
lamp.deactivate()
|
lamp.deactivate()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user