fuseCollision<C extends PositionComponent> function

void fuseCollision<C extends PositionComponent>(
  1. FuseCollisionFn<C> fn
)

Calls fn when this component is colliding with another component of type C.

Implementation

void fuseCollision<C extends PositionComponent>(FuseCollisionFn<C> fn) {
  _fuseCollisionsCheck();
  final component = fuseComponent<FuseCollisions>();

  component._collisionFns.add((target) {
    if (target is C) {
      fn(target);
    }
  });
}