34 lines
953 B
TypeScript
Raw Normal View History

2023-10-27 19:17:47 +08:00
import { Node } from "cc";
2023-10-27 02:38:08 +08:00
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
import GRoleBase from "../role/GRoleBase";
import GAttackNormal from "./GAttackNormal";
2023-10-27 19:17:47 +08:00
import GAttackParabolicRemote from "./GAttackParabolicRemote";
import { UITransform } from "cc";
import GButtleBase from "../bullet/GButtleBase";
2023-10-27 02:38:08 +08:00
2023-10-27 19:17:47 +08:00
//攻击子弹类
export class GAttackBullet{
2023-10-27 02:38:08 +08:00
2023-10-27 19:17:47 +08:00
//创建子弹
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;
}
2023-10-27 02:38:08 +08:00
2023-10-27 19:17:47 +08:00
}
2023-10-27 02:38:08 +08:00
//攻击方式基类
export class GAttackBase{
attack(role:GRoleBase<{}>,info:TableGRoleAttack){};
}
//攻击方式
2023-10-27 19:17:47 +08:00
export const GAttack:{[key:string]:(new () => GAttackBase)} = {
2023-10-27 02:38:08 +08:00
["Normal"]:GAttackNormal,
2023-10-27 19:17:47 +08:00
["ParabolicRemote"]:GAttackParabolicRemote,
2023-10-27 02:38:08 +08:00
}