"use strict";

class Scene8Controller extends BaseSceneController {
    _flowerTemplate;
    _flowerIndex = 0;

    initialize() {
        this.showText("flowers on his bed");

        var flower = this.spriteManager.get("flower2");
        this._flowerTemplate = flower.children[0];
    }

    update(time) {
        if (this._flowerIndex < 5 && time > this._flowerIndex * 260) {
            var flower = this._flowerTemplate.clone();
            flower.position.set(THREE.MathUtils.randFloat(-3, 3), THREE.MathUtils.randFloat(-0.01, -3), 0.0001);
            flower.scale.setScalar(THREE.MathUtils.randFloat(0.5, 1.9));
            this.scene.add(flower);
            this._flowerIndex++;
        }
    }

    clear() {
        // Empty on purpose, no clear
    }
}