This commit is contained in:
PC-20230316NUNE\Administrator
2023-10-28 18:50:06 +08:00
parent 324736a619
commit ca84f38096
11 changed files with 378 additions and 21 deletions

View File

@@ -15,6 +15,9 @@ import { Vec2 } from "cc";
export default class GAttackParabolicRemote implements GAttackBase{
attack(role: GRoleBase<{}>, info: TableGRoleAttack): void {
let enemy = role.fsm.enemy;
//[子弹图片]
let image:SpriteFrame = app.role.bullets[info.attackArgs[0]];
let scale:number = info.attackArgs[1] as unknown as number;
@@ -25,27 +28,29 @@ export default class GAttackParabolicRemote implements GAttackBase{
scale:scale,
});
role.mode.addGObject(bullet);
let world2 = role.node.worldPosition.clone().add(v3(bone.worldX,bone.worldY,0))
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 = role.fsm.enemy.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));
// start.rotate(90).normalize().multiplyScalar(50);
bullet.JTween({})
.to({},Vec2.distance(start,end)*3)
.onUpdate((data,elapsed) => {
// console.log(data,elapsed,bezier(0,6,12,1,elapsed),bezier(0,6,12,1,elapsed))
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(() => {
enemy.onHit();
bullet.node.removeFromParent();
})
.start();