添加新技能

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

View File

@@ -111,6 +111,15 @@ export class AtkConCom extends CCComp {
bm.rotationSmoothness=0.6
bm.moveTo(this.targetPos);
}
do_fixedEnd(){
this.node.setPosition(this.targetPos.x > 360?300:this.targetPos.x,0,0)
this.do_anim()
}
do_fixedStart(){
this.node.setPosition(this.startPos.x > 360?300:this.startPos.x,0,0)
this.do_anim()
}
onAnimationFinished(){
// console.log("[SkillCom]:onAnimationFinished",this.s_uuid)
if (!this.skillConfig) return;

View File

@@ -30,13 +30,15 @@ load(startPos: Vec3, parent: Node, uuid: number, targetPos: any[], caster:Hero
console.error("[Skill] 预制体加载失败:", path);
return;
}
console.log("load skill startPos",startPos)
// console.log("load skill startPos",startPos)
const node: Node = instantiate(prefab);
console.log("load skill node",node)
node.parent = parent;
// 设置节点属性
node.setPosition(startPos);
if(caster.fac==FacSet.MON){
node.scale=v3(node.scale.x*-1,1,1)
}else{
if(caster.type==HType.warrior){
if(caster.node.scale.x<0){

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()
}