2023-10-30 02:34:11 +08:00

34 lines
971 B
TypeScript

import { Node } from "cc";
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
import GRoleBase from "../role/GRoleBase";
import GAttackNormal from "./GAttackNormal";
import GAttackParabolicBangRemote from "./GAttackParabolicBangRemote";
import { UITransform } from "cc";
import GButtleBase from "../bullet/GButtleBase";
//攻击子弹类
export class GAttackBullet{
//创建子弹
static create<T extends GButtleBase<{}>>(GClass:{new():T},data:{}):T{
let bulletNode = new Node();
bulletNode.addComponent(UITransform);
let bullet = bulletNode.addComponent(GClass);
bullet.setData(data);
return bullet;
}
}
//攻击方式基类
export interface GAttackBase{
attack(role:GRoleBase<{}>,info:TableGRoleAttack);
}
//攻击方式
export const GAttack:{[key:string]:(new () => GAttackBase)} = {
["Normal"]:GAttackNormal,
["ParabolicBangRemote"]:GAttackParabolicBangRemote,
}