package de.steamwar.lobby.particle.elements;

import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;

public class Group extends DelegatingParticleElement {

    private final ParticleElement[] rest;

    public Group(ParticleElement particleElement, ParticleElement... rest) {
        super(particleElement);
        this.rest = rest;
    }

    @Override
    public String attribute() {
        return null;
    }

    @Override
    public void aggregateAttributes(ParticleData particleData) {
        particleElement.aggregateAttributes(particleData);
        for (ParticleElement particleElement : rest) {
            particleElement.aggregateAttributes(particleData);
        }
    }

    @Override
    public void tick(ParticleTickData particleTickData) {
        particleElement.tick(particleTickData);
        for (ParticleElement particleElement : rest) {
            particleElement.tick(particleTickData);
        }
    }
}
