from src.targets.Target import Target

class Bank(Target):
    def __init__(self, points, name, targets):
        super(points, name)
        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__)