import GAttackNormal from "./GAttackNormal";
import GAttackParabolicBangRemote from "./GAttackParabolicBangRemote";
import { UITransform } from "cc";
import GButtleBase from "../bullet/GButtleBase";
import GRoleDefault from "../role/GRoleDefault";
import GNode from "../common/GNode";
import { TB } from "../../../config/data/schema";
import GAttackParabolicSingleRemote from "./GAttackParabolicSingleRemote";

//攻击子弹类
export class GAttackBullet{

    //创建子弹
    static create<T extends GButtleBase<{}>>(GClass:{new():T},data:{}):T{
        let bulletNode = GNode.create();
        bulletNode.addComponent(UITransform);
        let bullet = bulletNode.addComponent(GClass);
        bullet.setData(data);
        return bullet;
    }

}

//攻击方式基类
export interface GAttackBase{
    attack(role:GRoleDefault,info:TB.TbGRoleAttack);
}

//攻击方式
export const GAttack:{[key:string]:(new () => GAttackBase)} = {
    ["Normal"]:GAttackNormal,
    ["ParabolicBangRemote"]:GAttackParabolicBangRemote,
    ["ParabolicSingleRemote"]:GAttackParabolicSingleRemote,
}

