import HarmNum from "../monster/harmnum";
import { ResMgr } from "../res/resMgr";

export class EffectMgr {
    private static _inst: EffectMgr;
    public static get inst(): EffectMgr {
        if (this._inst == null) {
            this._inst = new EffectMgr();
        }
        return this._inst;
    }

    layer: cc.Node;

    async createHarmNum(worldPos: cc.Vec2, harm: number){
        let harmNode = await ResMgr.inst.loadPrefab('monster/harmNum', this.layer);
        let localPos = this.layer.convertToNodeSpaceAR(worldPos);
        harmNode.setPosition(localPos);

        let harmCpt = harmNode.getComponent(HarmNum);
        harmCpt.setHarm(harm);
    }
}