import Bullet from "../Game/Bullet";
import { Pool } from "../Component/Pool";

export class BulletPool extends Pool<Bullet> {
    public spwan() {
        if (this.data.length > 0) {
            const element = this.data.shift();
            element.onElementInit();
            return element;
        } else {
            const b = new Bullet();
            this.layer.addChild(b);
            return b;
        }
    }
}