package com.github.orpheus2015.games.common.explosions;

import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.github.orpheus2015.engine.pool.SpritesPool;

public class ExplosionPool extends SpritesPool<Explosion> {

    private final TextureRegion explosionRegion;
    private Sound soundExplosion;

    public ExplosionPool(TextureAtlas atlas, Sound soundExplosion) {
        String regionName = "boom";
        explosionRegion = atlas.findRegion(regionName);
        if(explosionRegion == null) throw new RuntimeException("Region " + regionName + " not found.");
        this.soundExplosion = soundExplosion;
    }

    @Override
    protected Explosion newObject() {
        return new Explosion(explosionRegion, 9, 9, 74, soundExplosion);
    }
}
