import StartScene from "./StartScene";
import createItem from "./items/createItem";
import { award, awardMask } from "./collisionConfig";

export default (_this: StartScene) => {
    let count = 0;
    const coinsFall = setInterval(() => {
        if (count < 12) {
            let scale;
            scale = 0.7 + Math.random() * 0.3;
            const baseItem = createItem(scale);
            let angle;
            angle = 0;
            //气泡纹理种气泡的尺寸默认100（总体还包含气泡周围的阴影效果）
            //刚体和贴图尺寸比为1:1.12
            _this._egretRender.circle(375 + Math.random() * 200 - 100, 400 + 200 + 100, 100 * scale / 2 / 1.12, baseItem,
                {
                    frictionAir:0,
                    collisionFilter: { group: award, category: award, mask: awardMask },
                    angle: angle,
                    label: baseItem.type
                });
            count++;
        } else {
            //结束
        }
    }, 100);
}