mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-01-27 21:31:22 +00:00
16 lines
675 B
TypeScript
16 lines
675 B
TypeScript
import { IProjectileCollisionSignaler } from "../Projectile/IProjectileCollisionSignaler";
|
|
import { ProjectileCollision } from "../Projectile/ProjectileCollision";
|
|
import { Enemy } from "../Unit/Enemy/Enemy";
|
|
|
|
export class PlayerProjectileCollisionSystem {
|
|
public constructor(collisionSignalers: IProjectileCollisionSignaler[]) {
|
|
for (const collisionSignaler of collisionSignalers) {
|
|
collisionSignaler.ProjectileCollisionEvent.on(this.onProjectileCollision, this);
|
|
}
|
|
}
|
|
|
|
private onProjectileCollision(projectileCollision: ProjectileCollision): void {
|
|
projectileCollision.otherCollider.getComponent(Enemy).dealDamage(1);
|
|
}
|
|
}
|