技能动画添加

This commit is contained in:
walkpan
2025-01-05 09:10:21 +08:00
parent 66f4a0de82
commit 511459c66c
118 changed files with 22272 additions and 8796 deletions

View File

@@ -4,29 +4,17 @@ const { ccclass, property } = _decorator;
@ccclass('LineCom')
export class LineCom extends Component {
base:SkillCom = null
start() {
let base =this.node.getComponent(SkillCom)
let time = 720 / base.speed;
let squaredDistance = base.t_pos.x * base.t_pos.x + base.t_pos.y * base.t_pos.y;
let distance = Math.sqrt(squaredDistance);
time = distance / base.speed;
let e_pos=v3(this.node.position.x+base.t_pos.x,this.node.position.y+base.t_pos.y)
// console.log("skill tx:"+e_pos.x+" node :"+this.node.position.x)
this.node.getChildByName("skill").setRotationFromEuler(0,0,base.angle)
// console.log("skill ",this.node.getRotation())
tween(this.node).to( time,{ position: e_pos},
{
easing: "linear",
onUpdate: (target: Vec3, ratio: number) => { },
onComplete: (target?: object) => {
base.is_destroy=true
},
}
).start();
this.base =this.node.getComponent(SkillCom)
}
update(deltaTime: number) {
this.node.setPosition(this.node.position.x+this.base.speed*deltaTime,this.node.position.y,this.node.position.z)
if(this.node.position.x>1000||this.node.position.x<-1000){
this.base.is_destroy = true
}
}
}