This repository was archived by the owner on Apr 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheventmanager.py
74 lines (65 loc) · 2.35 KB
/
eventmanager.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from oceangui.events import EventManager, INotifyable
class ZombieAttack (INotifyable):
def set_unit(self, unit, x_coord, y_coord):
"""
Sets the unit to the desired x and y coordnates for the event
"""
self.x = x_coord
self.y = y_coord
# Draw Zombie
pass
def notify (self, event):
# Check the event signal and run a certain action with its data.
if event.signal == "clicked":
print "Something was clicked!"
elif event.signal == "move":
# Assuming that the event.data contains a coordinate tuple.
self.move (event.data)
class SurvivorFound (INotifyable):
def set_unit(self, unit, x_coord, y_coord):
"""
Sets the unit to the desired x and y coordnates for the event
"""
self.x = x_coord
self.y = y_coord
# Draw Zombie
pass
def notify (self, event):
# Check the event signal and run a certain action with its data.
if event.signal == "clicked":
print "Something was clicked!"
elif event.signal == "move":
# Assuming that the event.data contains a coordinate tuple.
self.move (event.data)
class WeaponFound (INotifyable):
def set_item(self, item, x_coord, y_coord):
"""
Sets the unit to the desired x and y coordnates for the event
"""
self.x = x_coord
self.y = y_coord
# Draw Zombie
pass
def notify (self, event):
# Check the event signal and run a certain action with its data.
if event.signal == "clicked":
print "Something was clicked!"
elif event.signal == "move":
# Assuming that the event.data contains a coordinate tuple.
self.move (event.data)
class FoodFound (INotifyable):
def set_item(self, item, x_coord, y_coord):
"""
Sets the unit to the desired x and y coordnates for the event
"""
self.x = x_coord
self.y = y_coord
# Draw Zombie
pass
def notify (self, event):
# Check the event signal and run a certain action with its data.
if event.signal == "clicked":
print "Something was clicked!"
elif event.signal == "move":
# Assuming that the event.data contains a coordinate tuple.
self.move (event.data)