package de.frajul.endlessroll.entities;

import android.support.annotation.Nullable;

import de.frajul.endlessroll.data.Vector;
import de.frajul.endlessroll.entities.particles.ParticleEffect;
import de.frajul.endlessroll.entities.particles.ParticleSource;
import de.frajul.endlessroll.entities.particles.ParticleSystem;

/**
 * Created by Julian on 11.03.2016.
 */
public enum DestroyEffect {

    EXPLOSION, STAR_EXPLOSION, ENERGY_COLLECT, NONE;

    @Nullable
    public ParticleSource createEffect(ParticleSystem system, Vector position, Vector size) {
        if (this == NONE)
            return null;
        ParticleSource source = new ParticleSource(position, getEffect(system));
        source.setSpawnSize(size);
        return source;
    }

    private ParticleEffect getEffect(ParticleSystem system) {
        switch (this) {
            case EXPLOSION:
                return system.explosion;
            case STAR_EXPLOSION:
                return system.starCollect;
            case ENERGY_COLLECT:
                return system.energyCollect;
            default:
                return null;
        }
    }

}
