-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgamestate.py
50 lines (44 loc) · 1.48 KB
/
gamestate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import map
import player
import volume
class GameStateManager:
def __init__(self):
self.gamestate = GameState()
class GameState:
def __init__(self):
self.map = map.Map()
self.player = player.Player()
self.round_phase = ''
self.round_bomb = ''
self.alive = 1
def update_round_phase(self, phase):
self.round_phase = phase
if phase == "freezetime":
#print("Setting volume to high")
volume.highVolume()
self.alive = 1
def update_round_bomb(self, bomb):
self.round_bomb = bomb
if bomb == "exploded":
#print("Bomb exploded: Setting volume to low")
volume.bombVolume()
def update_player_health(self, health):
if self.player.state.health != health:
self.player.state.health = health
#print(self.player.state.health)
if health == 0:
#print("Setting volume to low")
self.alive = 0
volume.deathVolume()
def update_player_flashed(self, flashed):
if self.player.state.flashed != flashed:
if self.player.state.flashed < flashed:
if flashed > 0:
volume.flashVolume()
self.player.state.flashed = flashed
if flashed < 200:
if self.alive:
volume.highVolume()
else:
#print("Setting volume to low")
volume.deathVolume()