This commit is contained in:
PC-20230316NUNE\Administrator
2023-10-27 19:17:47 +08:00
parent 7e402432dd
commit c4e6d02388
20 changed files with 163 additions and 28 deletions

View File

@@ -1,10 +1,24 @@
import { Node } from "cc";
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
import GRoleBase from "../role/GRoleBase";
import GAttackNormal from "./GAttackNormal";
import GAttackRemote from "./GAttackRemote";
import GAttackParabolicRemote from "./GAttackParabolicRemote";
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 class GAttackBase{
@@ -12,8 +26,8 @@ export class GAttackBase{
}
//攻击方式
export const GAttack:{[key:string]:new () => GAttackBase} = {
export const GAttack:{[key:string]:(new () => GAttackBase)} = {
["Normal"]:GAttackNormal,
["Remote"]:GAttackRemote,
["ParabolicRemote"]:GAttackParabolicRemote,
}

View File

@@ -0,0 +1,12 @@
export default class GAttackBullet {
//创建子弹
static create(){
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "565d04ae-ff80-4b3c-ac82-97dfcce552c2",
"uuid": "13b542e0-5fa9-4b1d-bfef-8196b3b3ffd6",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -0,0 +1,34 @@
import { SpriteFrame } from "cc";
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
import { app } from "../../../App";
import GRoleBase from "../role/GRoleBase";
import { GAttackBase, GAttackBullet } from "./GAttack";
import GButtleDefault from "../bullet/GButtleDefault";
import { size } from "cc";
import { Size } from "cc";
import { Vec2 } from "cc";
import { v2 } from "cc";
import { v3 } from "cc";
/**
* 抛物线普攻
*/
export default class GAttackParabolicRemote implements GAttackBase{
attack(role: GRoleBase<{}>, info: TableGRoleAttack): void {
//[子弹图片]
let image:SpriteFrame = app.role.bullets[info.attackArgs[0]];
let scale:number = info.attackArgs[1] as unknown as number;
let bone = role.spine.findBone("timo5 007");
console.log(role.spine,bone);
let bullet = GAttackBullet.create(GButtleDefault,{
image:image,
scale:scale,
});
role.mode.addGObject(bullet);
let world2 = role.node.worldPosition.clone().add(v3(bone.worldX,bone.worldY,0))
bullet.node.setWorldPosition(v3(world2.x,world2.y,world2.z))
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "8c684f5a-84b5-4ea1-92d3-c0b70461970c",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,15 +0,0 @@
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
import { app } from "../../../App";
import GRoleBase from "../role/GRoleBase";
import { GAttackBase } from "./GAttack";
export default class GAttackRemote implements GAttackBase{
attack(role: GRoleBase<{}>, info: TableGRoleAttack): void {
console.log(app.role.bullets[info.attackArgs[0]]);
role.fsm.enemy.onHit();
}
}