
import { LQCollide } from "../../../lq_collide_system/lq_collide";
import { LQCollideBase } from "../../../lq_collide_system/lq_collide_base";
import { LQCollideInfoList } from "../../../lq_collide_system/lq_collide_config";
import { EffectMgr } from "../nest/effectMgr";

const {ccclass, property, requireComponent} = cc._decorator;
@ccclass
@requireComponent(LQCollideBase)
export default class monsterbullet extends LQCollide {

    /*===========================自动绑定组件开始===========================*/
	/*===========================自动绑定组件结束===========================*/

    /*===========================自动生成按钮事件开始==========================*/

	/*===========================自动生成按钮事件结束==========================*/

    atk: number = 1;

    protected onLoad(): void {
        cc.log('[monsterbullet] [onLoad]');
    }

    public on_enter(collide: LQCollide): void {
        cc.log('[monsterbullet] [on_enter]');
        if(collide.collide_group_index == LQCollideInfoList.role) {
            let worldPos = this.node.convertToWorldSpaceAR(cc.Vec2.ZERO);
            EffectMgr.inst.createHarmNum(worldPos, this.atk);
        }
        this.node.destroy();
    }



    setDirction(dir: cc.Vec2){
        let angle = cc.v2(0,1).signAngle(dir) / Math.PI * 180;
        this.node.angle = angle;
    }
}