36 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-10-27 02:38:08 +08:00
import GAttackNormal from "./GAttackNormal";
2023-10-30 02:34:11 +08:00
import GAttackParabolicBangRemote from "./GAttackParabolicBangRemote";
2023-10-27 19:17:47 +08:00
import { UITransform } from "cc";
import GButtleBase from "../bullet/GButtleBase";
2023-11-01 02:01:35 +08:00
import GRoleDefault from "../role/GRoleDefault";
2023-11-03 02:57:38 +08:00
import GNode from "../common/GNode";
2023-12-13 19:33:57 +08:00
import { TB } from "../../../config/data/schema";
2023-12-18 09:31:13 +08:00
import GAttackParabolicSingleRemote from "./GAttackParabolicSingleRemote";
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{
2023-11-03 02:57:38 +08:00
let bulletNode = GNode.create();
2023-10-27 19:17:47 +08:00
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
//攻击方式基类
2023-10-30 02:34:11 +08:00
export interface GAttackBase{
2023-11-06 02:25:02 +08:00
attack(role:GRoleDefault,info:TB.TbGRoleAttack);
2023-10-27 02:38:08 +08:00
}
//攻击方式
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-30 02:34:11 +08:00
["ParabolicBangRemote"]:GAttackParabolicBangRemote,
2023-12-18 09:31:13 +08:00
["ParabolicSingleRemote"]:GAttackParabolicSingleRemote,
2023-10-27 02:38:08 +08:00
}