import { _decorator, Component, log, Node, Sprite, SpriteFrame, Vec3 } from 'cc';
import { ModulerBase } from './ModulerBase';
import { gameResMgr } from '../GameResMgr';
const { ccclass, property } = _decorator;

@ccclass('ObstacleMgr')
export class ObstacleMgr extends ModulerBase {
    // @property(SpriteFrame)
    // frame: SpriteFrame = null;
    start() {

    }

    update(deltaTime: number) {
        
    }
    creatorObs(pos: Vec3, style: number, index: number){
        const frame = gameResMgr.getObsFrame(style, index);
        //拼接精灵帧的名字
        // 1 => 00 01  12 => 000 12
        let i: string = "000" + index;
        i ="cloud" + i.slice(i.length - 2);
        const node = new Node();
        node.addComponent(Sprite).spriteFrame = frame;
        node.setPosition(pos);
        node.parent = this.node;
    }
}


