Newer
Older
AlgebraicDataflowArchitectureModel / GameEngine / src / main / java / gameEngine / entites / GameObject.java
package gameEngine.entites;

import gameEngine.entites.gameComponents.GameComponent;

import java.util.ArrayList;
import java.util.List;

public class GameObject extends Entity {
    public boolean active = true;
    private final List<GameComponent> gameComponents = new ArrayList<>();

    public void addComponent(GameComponent component) {
        this.gameComponents.add(component);
    }

    public void initComponents() {
        for (GameComponent component : gameComponents) {
            component.init();
        }
    }

    public void updateComponents() {
        for (GameComponent component : gameComponents) {
            component.update();
        }
    }

    public void setActive(boolean active) {
        this.active = active;
    }
}