-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.py
More file actions
68 lines (37 loc) · 1.11 KB
/
events.py
File metadata and controls
68 lines (37 loc) · 1.11 KB
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class GameEvent:
"""
Base class for objects events
"""
def __init__(self, event_objs=None):
self._event_objs = event_objs or []
def get_event_objects(self):
return self._event_objs
class EventBorn(GameEvent):
def handle(self, obj):
obj.born()
class EventStopped(GameEvent):
def handle(self, obj):
obj.stopped()
class EventStoppedAtTargetPoint(GameEvent):
def handle(self, obj):
obj.stopped_at_target_point(self._event_objs)
class EventGunReloaded(GameEvent):
def handle(self, obj):
obj.gun_reloaded()
class EventCollide(GameEvent):
def handle(self, obj):
obj.collided_with(self._event_objs)
class EventHit(GameEvent):
def handle(self, obj):
obj.hitted()
class EventTargetDestroyed(GameEvent):
def handle(self, obj):
obj.target_destroyed()
class EventRadarRange(GameEvent):
def handle(self, obj):
obj.in_tank_radar_range(self._event_objs)
class EventHearbeat(GameEvent):
def handle(self, obj):
obj.hearbeat()