buff修改

This commit is contained in:
2024-12-31 10:31:56 +08:00
parent b717167afd
commit c8cd32b9e4
5 changed files with 6606 additions and 616 deletions

View File

@@ -18,57 +18,83 @@ export class BuffComp extends Component {
def_cd:number=0;
hp_cd:number=0;
crit_cd:number=0;
s_index=0
deap_cd:number=0;
decd_cd:number=0;
dedef_cd:number=0;
dehp_cd:number=0;
decrit_cd:number=0;
speek_time:number=0;
start() {
this.heroView = this.node.getComponent(HeroViewComp);
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = false;
}
update(deltaTime: number) {
if(this.ap_cd > 0 ) this.ap_cd -= deltaTime;
if(this.ap_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").setSiblingIndex(0);
this.s_index--
if(this.s_index< 0) this.s_index=0
}
if(this.cd_cd > 0 ) this.cd_cd -= deltaTime;
if(this.cd_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active) {
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").setSiblingIndex(0);
this.s_index--
if(this.s_index< 0) this.s_index=0
}
if(this.def_cd > 0 ) this.def_cd -= deltaTime;
if(this.def_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").setSiblingIndex(0);
this.s_index--
if(this.s_index< 0) this.s_index=0
}
if(this.hp_cd > 0 ) this.hp_cd -= deltaTime;
if(this.hp_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").setSiblingIndex(0);
this.s_index--
if(this.s_index< 0) this.s_index=0
}
if(this.crit_cd > 0 ) this.crit_cd -= deltaTime;
if(this.crit_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = false;
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").setSiblingIndex(0);
this.s_index--
if(this.s_index< 0) this.s_index=0
}
if(this.deap_cd > 0 ) this.deap_cd -= deltaTime;
if(this.deap_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("deap").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("deap").active = false;
}
if(this.decd_cd > 0 ) this.decd_cd -= deltaTime;
if(this.decd_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("decd").active) {
this.node.getChildByName("top").getChildByName("buff").getChildByName("decd").active = false;
}
if(this.dedef_cd > 0 ) this.dedef_cd -= deltaTime;
if(this.dedef_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("dedef").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("dedef").active = false;
}
if(this.dehp_cd > 0 ) this.dehp_cd -= deltaTime;
if(this.dehp_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("dehp").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("dehp").active = false;
}
if(this.decrit_cd > 0 ) this.decrit_cd -= deltaTime;
if(this.decrit_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("decrit").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("decrit").active = false;
}
@@ -84,34 +110,46 @@ export class BuffComp extends Component {
show_ap(t:number=2){
this.ap_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").setSiblingIndex(this.s_index);
console.log("show_ap",this.node.getChildByName("top").getChildByName("buff").getChildByName("ap"))
this.s_index++
}
show_cd(t:number=2){
this.cd_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").setSiblingIndex(this.s_index);
this.s_index++
}
show_def(t:number=2){
this.def_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").setSiblingIndex(this.s_index);
this.s_index++
}
show_hp(t:number=2){
this.hp_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").setSiblingIndex(this.s_index);
this.s_index++
}
show_crit(t:number=2){
this.crit_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").setSiblingIndex(this.s_index);
this.s_index++
}
show_debuff_ap(t:number=2){
this.deap_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = true;
console.log("show_ap",this.node.getChildByName("top").getChildByName("buff").getChildByName("ap"))
}
show_debuff_cd(t:number=2){
this.decd_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = true;
}
show_debuff_def(t:number=2){
this.dedef_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = true;
}
show_debuff_hp(t:number=2){
this.dehp_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = true;
}
show_debuff_crit(t:number=2){
this.decrit_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = true;
}
hp_show(){