mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-26 11:48:54 +00:00
17 lines
757 B
TypeScript
17 lines
757 B
TypeScript
import { IProjectileLauncherSignaler } from "../Projectile/IProjectileLauncherSignaler";
|
|
import { ProjectileCollision } from "../Projectile/ProjectileCollision";
|
|
import { Enemy } from "../Unit/Enemy/Enemy";
|
|
|
|
export class PlayerProjectileCollisionSystem {
|
|
public constructor(collisionSignalers: IProjectileLauncherSignaler[]) {
|
|
for (const collisionSignaler of collisionSignalers) {
|
|
collisionSignaler.ProjectileCollisionEvent.on(this.onProjectileCollision, this);
|
|
}
|
|
}
|
|
|
|
private onProjectileCollision(projectileCollision: ProjectileCollision): void {
|
|
projectileCollision.otherCollider.getComponent(Enemy).dealDamage(projectileCollision.projectile.Damage);
|
|
projectileCollision.projectile.pierce();
|
|
}
|
|
}
|