技能继续重构
This commit is contained in:
@@ -55,7 +55,6 @@ 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)
|
||||
@@ -72,14 +71,11 @@ 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`,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
|
||||
@@ -89,15 +85,13 @@ export class SkillViewCom extends CCComp {
|
||||
if(this.s_cd > 0) this.s_cd -= dt
|
||||
}
|
||||
doSkill(){
|
||||
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*atkNode.scale.x, this.node.position.y + this.atk_y))
|
||||
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);
|
||||
@@ -137,20 +131,15 @@ export class SkillViewCom extends CCComp {
|
||||
}
|
||||
}
|
||||
do_linear(atkNode:any): void {
|
||||
console.log(`${this.cName}_[SkillViewCom] skille run type: linear`,this.node.position,atkNode.position)
|
||||
atkNode.getComponent(AtkConCom).do_line()
|
||||
}
|
||||
do_bezier(atkNode:any): void {
|
||||
console.log(`${this.cName}_[SkillViewCom] skille run type: bezier`)
|
||||
atkNode.getComponent(AtkConCom).do_parabolic()
|
||||
}
|
||||
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()
|
||||
}
|
||||
move(dt: number): void {
|
||||
|
||||
Reference in New Issue
Block a user