package nz.ac.massey.javaecs.examples.Systems;

import java.util.BitSet;

import nz.ac.massey.javaecs.ECSSystem;
import nz.ac.massey.javaecs.Engine;
import nz.ac.massey.javaecs.Entity;
import nz.ac.massey.javaecs.examples.Components.Reporter;
import nz.ac.massey.javaecs.examples.Components.TextRender;

public class ReportSystem extends ECSSystem{
    Engine gameEngine;

    public ReportSystem(Engine gameEngine){
        this.gameEngine = gameEngine;
        // Set registrations
        registrationSet = new BitSet();
        registrationSet.set(gameEngine.getComponentIndex(Reporter.class));
        registrationSet.set(gameEngine.getComponentIndex(TextRender.class));
    }
    @Override
    public void init() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void update() {
        for (Entity entity : entities) {
            TextRender text = (TextRender)gameEngine.getComponentData(entity, TextRender.class);
            text.content = "Num Entities: " + gameEngine.getNumEntities();
        }
        
    }
    
}
