common event
This commit is contained in:
8
Event.py
Normal file
8
Event.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import logging
|
||||
|
||||
class Event:
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
def trigger(self):
|
||||
logging.info('Event ' + self.name + ' occured!')
|
||||
@@ -1,4 +1,6 @@
|
||||
class BonusTimeEvent:
|
||||
from Event import Event
|
||||
|
||||
class BonusTimeEvent(Event):
|
||||
def __init__(self, playerState):
|
||||
self.playerState = playerState
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class EndGameEvent:
|
||||
from Event import Event
|
||||
|
||||
class EndGameEvent(Event):
|
||||
def __init__(self, flipper):
|
||||
self.flipper = flipper
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class EndOfBallEvent:
|
||||
from Event import Event
|
||||
|
||||
class EndOfBallEvent(Event):
|
||||
def __init__(self, playerState):
|
||||
self.playerState = playerState
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from Event import Event
|
||||
|
||||
from solenoids.TopFlipper import TopFlipper
|
||||
|
||||
|
||||
class EnterUpperPlayfieldEvent:
|
||||
class EnterUpperPlayfieldEvent(Event):
|
||||
def __init__(self, playerState):
|
||||
self.playerState = playerState
|
||||
self.flipper = TopFlipper()
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class FlapEvent:
|
||||
from Event import Event
|
||||
|
||||
class FlapEvent(Event):
|
||||
def __init__(self, flapSolenoid):
|
||||
self.flapSolenoid = flapSolenoid
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class LeaveUpperPlayfieldEvent:
|
||||
from Event import Event
|
||||
|
||||
class LeaveUpperPlayfieldEvent(Event):
|
||||
def __init__(self, playerState, flipper):
|
||||
self.playerState = playerState
|
||||
self.flipper = flipper
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from Event import Event
|
||||
|
||||
from events.FlapEvent import FlapEvent
|
||||
from solenoids.LeftFlapSolenoid import LeftFlapSolenoid
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class PointEvent:
|
||||
from Event import Event
|
||||
|
||||
class PointEvent(Event):
|
||||
def __init__(self, playerState):
|
||||
self.playerState = playerState
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from Event import Event
|
||||
|
||||
from events.FlapEvent import FlapEvent
|
||||
from solenoids.RightFlapSolenoid import RightFlapSolenoid
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from Event import Event
|
||||
|
||||
from solenoids.RightKickerSolenoid import RightKickerSolenoid
|
||||
|
||||
|
||||
class RightKickerEvent:
|
||||
class RightKickerEvent(Event):
|
||||
def __init__(self):
|
||||
self.rightKickerSolenoid = RightKickerSolenoid()
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from Event import Event
|
||||
|
||||
from solenoids.OutHoleSolenoid import OutHoleSolenoid
|
||||
from solenoids.MainFlipper import MainFlipper
|
||||
|
||||
|
||||
class StartGameEvent:
|
||||
class StartGameEvent(Event):
|
||||
def __init__(self):
|
||||
self.flipper = MainFlipper()
|
||||
self.outHoleSolenoid = OutHoleSolenoid()
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class UpperPlayfieldTimeEvent:
|
||||
from Event import Event
|
||||
|
||||
class UpperPlayfieldTimeEvent(Event):
|
||||
def __init__(self, playerState):
|
||||
self.playerState = playerState
|
||||
|
||||
|
||||
Reference in New Issue
Block a user