create input functionality

This commit is contained in:
Jonas Zeunert
2019-10-30 21:37:16 +01:00
parent a69a66394b
commit d324811649
5 changed files with 124 additions and 1 deletions

21
cli/Bank.py Normal file
View File

@@ -0,0 +1,21 @@
class Bank(Target):
def __init__(self, targets):
self.targets = targets
self.__register_targets__()
def __target_hit__(self, target):
if all(target.is_hit for target in self.targets):
self.__all_targets_hit__()
def __all_targets_hit__(self):
self.__reset_all_targets__()
super.hit()
pass
def __reset_all_targets__(self):
for target in self.targets:
target.reset()
def __register_targets__(self):
for target in self.targets:
target.on(target.hit_key, self.__target_hit__)