mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-01-14 06:51:30 +00:00
17 lines
760 B
TypeScript
17 lines
760 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(projectileCollision.projectile.Damage);
|
|
projectileCollision.projectile.pierce();
|
|
}
|
|
}
|