package alexiil.space.entities;

import alexiil.space.EDamageType;
import alexiil.space.SpaceLasers;
import alexiil.space.world.World;

public abstract class EntityParticle extends Entity {
    protected int timeToLive;

    public EntityParticle(World world, double x, double y) {
        super(world, x, y);
        timeToLive = (int) SpaceLasers.tickPerSecond / 2;
    }

    @Override
    public void attack(Entity from, int damage) {}

    @Override
    public boolean canCollide(Entity entity) {
        return false;
    }

    @Override
    public int getBoundingRadius() {
        return 0;
    }

    @Override
    public int getDamage(EDamageType dt) {
        return 0;
    }

    @Override
    public void onCollide(Entity collidingEntity) {}

    @Override
    public void updateLogic() {
        if (!SpaceLasers.particles.getAsBoolean()) isDead = true;
        timeToLive -= 1;
        if (timeToLive < 1) isDead = true;
    }

    /* (non-Javadoc)
     * 
     * @see java.lang.Object#toString() */
    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("EntityParticle [timeToLive=");
        builder.append(timeToLive);
        builder.append("]");
        return builder.toString();
    }
}
