This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-12-18 09:31:13 +08:00
parent 9a3f666df1
commit 300eb7d5d4
95 changed files with 4240 additions and 83 deletions

View File

@@ -5,6 +5,7 @@ import GButtleBase from "../bullet/GButtleBase";
import GRoleDefault from "../role/GRoleDefault";
import GNode from "../common/GNode";
import { TB } from "../../../config/data/schema";
import GAttackParabolicSingleRemote from "./GAttackParabolicSingleRemote";
//攻击子弹类
export class GAttackBullet{
@@ -29,5 +30,6 @@ export interface GAttackBase{
export const GAttack:{[key:string]:(new () => GAttackBase)} = {
["Normal"]:GAttackNormal,
["ParabolicBangRemote"]:GAttackParabolicBangRemote,
["ParabolicSingleRemote"]:GAttackParabolicSingleRemote,
}

View File

@@ -19,7 +19,7 @@ import { sp } from "cc";
* 抛物线 爆炸普攻
* 攻击子弹,爆炸特效,龙骨-初始位置,子弹大小,爆炸宽度,爆炸高度
*/
export default class GAttackParabolicRemote implements GAttackBase{
export default class GAttackParabolicBangRemote implements GAttackBase{
attack(role: GRoleDefault, info: TB.TbGRoleAttack): void {
@@ -36,7 +36,7 @@ export default class GAttackParabolicRemote implements GAttackBase{
let ah = parseFloat(info.attackArgs[5]);
if(!image || !bone || !scale || !bang|| !aw|| !ah) {
console.warn("GAttackParabolicRemote ERROR",image,bone,scale,bang);
console.warn("GAttackParabolicBangRemote ERROR",image,bone,scale,bang);
return;
}

View File

@@ -0,0 +1,82 @@
import { SpriteFrame } from "cc";
import { TD, app } from "../../../App";
import GRoleBase from "../role/GRoleBase";
import { GAttackBase, GAttackBullet } from "./GAttack";
import GButtleDefault from "../bullet/GButtleDefault";
import { v3 } from "cc";
import { bezier } from "cc";
import { v2 } from "cc";
import { Vec2 } from "cc";
import GEffectUtil from "../common/GEffectUtil";
import GDetection from "../common/GDetection";
import { rect } from "cc";
import GRoleDefault from "../role/GRoleDefault";
import { TB } from "../../../config/data/schema";
import GRoleAttack from "../common/GRoleAttack";
import { sp } from "cc";
/**
* 抛物线 单体普攻
* 攻击子弹,龙骨-初始位置,子弹大小
*/
export default class GAttackParabolicSingleRemote implements GAttackBase{
attack(role: GRoleDefault, info: TB.TbGRoleAttack): void {
let enemy = role.fsm.enemy;
if(!enemy) return;
let image:SpriteFrame = app.battleRes.getData<SpriteFrame>(info.attackArgs[0]);
let bone = role.spine.findBone(info.attackArgs[1]);
let scale:number = parseFloat(info.attackArgs[2]);
if(!image || !bone || !scale) {
console.warn("GAttackParabolicBangRemote ERROR",image,bone,scale);
return;
}
let bullet = GAttackBullet.create(GButtleDefault,{
image:image,
scale:scale,
});
role.mode.addGObject(bullet);
let world2 = role.node.worldPosition.clone().add(v3(role.getMirrorValue(bone.worldX),bone.worldY,0))
//设置子弹位置
bullet.node.setWorldPosition(v3(world2.x,world2.y,world2.z))
//子弹移动
let start = bullet.v2World;
let end = enemy.v2World;
let center = v2(((start.x + end.x) / 2),((start.y + end.y) / 2) + (Math.abs((start.x - end.x)) / 2));
bullet.JTween({})
.to({},Vec2.distance(start,end)*3)
.onUpdate((data,elapsed) => {
if(enemy.get()){
end = enemy.v2World;
center = v2(((start.x + end.x) / 2),((start.y + end.y) / 2) + (Math.abs((start.x - end.x)) / 2));
}
bullet.node.setWorldPosition(v3(
bezier(start.x,center.x,center.x,end.x,elapsed),
bezier(start.y,center.y,center.y,end.y,elapsed),
0
))
})
.onComplete(() => {
//销毁
bullet.node.destroy();
//普攻
GRoleAttack.onNormalAttack(role,enemy);
})
.start();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "579198ed-da4c-4524-a4ae-8ddad83f3680",
"files": [],
"subMetas": {},
"userData": {}
}