怪物 改为3条直线 进入, 攻击动画 直线的已改, 抛物线和群攻的 也需要修改

This commit is contained in:
2025-07-17 09:53:19 +08:00
parent 8aa4edabd4
commit 5a9da59acc
13 changed files with 62 additions and 37 deletions

View File

@@ -87,15 +87,35 @@ export class SkillCom extends CCComp {
collider.group = this.group;
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
}
let bm=this.node.getComponent(BezierMove)
// console.log(this.group +"技能 collider ",collider);
switch(SkillSet[this.s_uuid].AType){
case AType.parabolic:
this.node.angle +=10
let bm=this.node.getComponent(BezierMove)
// bm.speed=700
if(this.group==BoxSet.MONSTER) bm.controlPointSide=-1
if(this.group==BoxSet.MONSTER) {bm.controlPointSide=-1 }
bm.rotationSmoothness=0.6
bm.moveTo(this.targetPos)
break;
case AType.linear:
let s_x=this.startPos.x
let s_y=this.startPos.y
let t_x=this.targetPos.x
let t_y=this.targetPos.y
// 设定目标x
this.targetPos.x = 400;
if(this.group == BoxSet.MONSTER) {
bm.controlPointSide = -1;
this.targetPos.x = -400;
}
// 计算斜率
const k = (t_y - s_y) / (t_x - s_x);
// 按直线公式计算新的y
this.targetPos.y = k * (this.targetPos.x - s_x) + s_y;
bm.controlPointOffset=0
bm.rotationSmoothness=0.6
bm.moveTo(this.targetPos);
break;
case AType.StartEnd:
// 2段位移先升高然后移到目的地
this.executeTwoStageMovement();
@@ -280,7 +300,7 @@ export class SkillCom extends CCComp {
this.range_damage()
}
//直线移动
if(this.AType == AType.linear) this.startLinearMove(deltaTime);
// if(this.AType == AType.linear) this.startLinearMove(deltaTime);
this.toDestroy();
}