添加新技能

This commit is contained in:
2025-10-15 22:56:55 +08:00
parent 9e2ae6f30f
commit 7ec02c4b9e
19 changed files with 3528 additions and 1823 deletions

View File

@@ -64,11 +64,13 @@ export class SkillViewCom extends CCComp {
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
this.node.getChildByName("ready").active = this.hasReady
console.log("[skillView] start ",this.hasReady)
}
protected update(dt: number): void {
this.doTimer(dt)
this.move(dt)
this.doEnd(dt)
this.do_cd(dt)
if(this.readyFinish) this.doAtk(dt)
}
doEnd(dt: number) {
@@ -79,25 +81,32 @@ export class SkillViewCom extends CCComp {
}
doTimer(dt: number){
console.log('[skillview]:doTimer',this.ReadyTime,this.readyFinish)
if(this.ReadyTime > 0) this.ReadyTime -= dt
if(this.ReadyTime <=0) this.readyFinish=true
}
doAtk(dt:number): void {
// console.log(`${this.cName}_[SkillViewCom] doAtkC`)
console.log(`${this.cName}_[SkillViewCom] doAtkC`,this.s_cd,this.s_count)
if(this.s_cd <= 0&&this.s_count > 0) {
console.log(`${this.cName}_[SkillViewCom] doAtk 2`)
this.doSkill()
this.s_count--
this.s_cd = this.s_interval
}
}
do_cd(dt:number){
if(this.s_cd > 0) this.s_cd -= dt
}
doSkill(){
// console.log(`${this.cName}_[SkillViewCom] doSkill`,this.atkPrefab)
console.log(`${this.cName}_[SkillViewCom] atkPrefab`,this.atkPrefab)
if(this.atkPrefab!=null){
let atkNode:Node = instantiate(this.atkPrefab)
atkNode.parent = this.node.parent
atkNode.setPosition(v3(this.node.position.x + this.atk_x*this.scale, this.node.position.y + this.atk_y))
// console.log(`${this.cName}_[SkillViewCom] doSkill atkNode`,this.node.position,atkNode.position)
if(this.node.scale.x < 0){
atkNode.setScale(v3(atkNode.scale.x*-1,atkNode.scale.y,atkNode.scale.z))
}
atkNode.setPosition(v3(this.node.position.x + this.atk_x*atkNode.scale.x, this.node.position.y + this.atk_y))
console.log(`${this.cName}_[SkillViewCom] doSkill atkNode`,this.node.position,atkNode.position)
let atkCom=atkNode.getComponent(AtkConCom)
// 计算延长后的目标点坐标
const originalStart = v3(this.node.position.x + this.atk_x, this.node.position.y + this.atk_y);
@@ -142,6 +151,9 @@ export class SkillViewCom extends CCComp {
case RType.fixed:
this.do_fixed(atkNode)
break
case RType.fixedEnd:
this.do_fixedEnd(atkNode)
break
}
}
}
@@ -155,6 +167,12 @@ export class SkillViewCom extends CCComp {
}
do_fixed(atkNode:any): void {
console.log(`${this.cName}_[SkillViewCom] skille run type: fixed`)
atkNode.getComponent(AtkConCom).do_fixedStart()
}
do_fixedEnd(atkNode:any): void {
console.log(`${this.cName}_[SkillViewCom] skille run type: fixedEnd`)
atkNode.getComponent(AtkConCom).do_fixedEnd()
}