import { MarkerNodeEntityProcessor } from "./MarkerNodeEntityProcessor.js";
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
import { Transform } from "../../../../engine/ecs/transform/Transform.js";

export class MarkerNodeEntityProcessorRandomRotation extends MarkerNodeEntityProcessor {

    __seed = 0;
    __random = seededRandom(0);

    static from() {
        return new MarkerNodeEntityProcessorRandomRotation();
    }

    initialize(data, ecd) {
        this.__random.setCurrentSeed(this.__seed);
    }

    execute(entity, node, data, ecd) {
        const transform = entity.getComponent(Transform);

        if (transform === null) {
            return;
        }

        transform.rotation.random(this.__random);
    }
}
