DESKTOP-5RP3AKU\Jisol 6ebed0b45e 重构继承关系
2023-11-01 02:01:35 +08:00

37 lines
1.1 KiB
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";
import { GFSMAnimBase } from "../fsm/GFSMAnimBase";
import GFSMBase from "../fsm/GFSMBase";
import GRoleDefault from "../role/GRoleDefault";
//攻击子弹类
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:GRoleDefault,info:TableGRoleAttack);
}
//攻击方式
export const GAttack:{[key:string]:(new () => GAttackBase)} = {
["Normal"]:GAttackNormal,
["ParabolicBangRemote"]:GAttackParabolicBangRemote,
}