

import Sprite3D = Laya.Sprite3D;
import Dictionary from "../Util/Dictionary";
import { Mathf } from "../Util/Mathf";
import { GamePool } from "./GamePool";
import Vector3 = Laya.Vector3;
import { GlobalVariable } from "../game_module/GlobalVariable";
import { Scene3DManager } from "./Scene3DManager";
export class ParticleManager {
    private static instance: ParticleManager;
    public static get Instance(): ParticleManager {
        return ParticleManager.instance || (ParticleManager.instance = new ParticleManager());
    }
    static effectName = {
        hit: "hit",
        xue: "xue",
        boom: "boom"
    }
    private hitmaxcount = 0;
    CreateHitEffect(pos) {
        if (this.hitmaxcount >= GlobalVariable.hitmaxcount) return;
        let h = GamePool.Instance.SetActiveObject("hit");
        h.transform.position = pos;
        Scene3DManager.Instance.effectCon.addChild(h);
        this.hitmaxcount++;
        Laya.timer.once(800, this, this.DisSpH, [h], false);
    }
    DisSpH(sp: Sprite3D) {
        GamePool.Instance.SetDisableObject(sp);
        this.hitmaxcount--;
    }
    private boommaxcount = 0;
    CreateBoomEffect(pos) {
        if (this.boommaxcount >= GlobalVariable.boommaxcount) return;
        let h = GamePool.Instance.SetActiveObject("boom");
        h.transform.position = pos;
        Scene3DManager.Instance.effectCon.addChild(h);
        this.boommaxcount++;
        Laya.timer.once(800, this, this.DisSpB, [h], false);
    }
    DisSpB(sp: Sprite3D) {
        GamePool.Instance.SetDisableObject(sp);
        this.boommaxcount--;
    }

    CreateXueEffect(pos) {
        let h = GamePool.Instance.SetActiveObject("xue");
        h.transform.position = pos;
        Scene3DManager.Instance.effectCon.addChild(h);
        Laya.timer.once(800, this, this.DisSpX, [h], false);
    }
    DisSpX(sp: Sprite3D){
        GamePool.Instance.SetDisableObject(sp);
    }
}