AI-Project/survival/components/OnCollisionComponent.py

16 lines
366 B
Python
Raw Normal View History

2021-05-23 14:33:05 +02:00
from functools import partial
class OnCollisionComponent:
2021-05-23 14:33:05 +02:00
def __init__(self, callbacks=None):
if callbacks is None:
callbacks = []
self.callbacks = callbacks
def callAll(self):
for func in self.callbacks:
func()
2021-05-23 14:33:05 +02:00
def addCallback(self, fn, **kwargs):
self.callbacks.append(partial(fn, **kwargs))