package electrosphere.game.server.effects;

import electrosphere.entity.Entity;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.types.particle.ParticleUtils;
import java.util.Random;
import org.joml.Vector3f;

/**
 *
 * @author amaterasu
 */
public class ParticleEffects {
    
    
    public static void spawnSparks(Vector3f position, int min, int max){
        Random rand = new Random();
        int num = (int)(rand.nextFloat() * (max - min)) + min;
        for(int i = 0; i < num; i++){
            Vector3f direction = new Vector3f(rand.nextFloat() - 0.5f,rand.nextFloat() - 0.5f,rand.nextFloat() - 0.5f).normalize();
            float velocity = rand.nextFloat() * 0.01f;
            float acceleration = 0.005f;
            Entity spark = ParticleUtils.spawnBillboardParticle("Textures/spark1.png", 15, direction, velocity, acceleration);
            EntityUtils.getPosition(spark).set(position);
            EntityUtils.getScale(spark).mul(0.03f);
        }
    }
}
