buff修改
This commit is contained in:
@@ -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(){
|
||||
|
||||
@@ -116,7 +116,8 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
|
||||
stop_cd: number = 0.5; /*停止倒计时*/
|
||||
|
||||
yun_cd: number = 0.5; //眩晕倒计时
|
||||
ice_cd: number = 0.5; //冰冻倒计时
|
||||
dir_y:number = 0;
|
||||
speek_time:number = 0;
|
||||
|
||||
@@ -203,6 +204,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.is_atking=true
|
||||
}
|
||||
}
|
||||
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
}
|
||||
update(dt: number){
|
||||
@@ -215,15 +217,30 @@ export class HeroViewComp extends CCComp {
|
||||
if (this.pwt.update(dt)) {
|
||||
this.pw+=this.pws
|
||||
}
|
||||
|
||||
this.check_power()
|
||||
this.check_atk_buffs(dt)
|
||||
this.check_atk_counts()
|
||||
this.in_stop(dt);
|
||||
this.at += dt;
|
||||
this.check_atk_counts()
|
||||
this.check_enemy_alive()
|
||||
this.check_mission_buf()
|
||||
|
||||
if(this.ice_cd > 0){ this.ice_cd -=dt; return }
|
||||
if(this.yun_cd > 0){ this.yun_cd -=dt; return }
|
||||
this.at += dt;
|
||||
|
||||
this.in_stop(dt);
|
||||
this.in_atk(dt);
|
||||
this.move(dt);
|
||||
this.check_mission_buf()
|
||||
}
|
||||
check_iceed(dt:number){
|
||||
if(this.ice_cd > 0){
|
||||
this.ice_cd -= dt;
|
||||
if(this.ice_cd <= 0){
|
||||
this.ice_cd = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
check_yuned(dt:number){
|
||||
|
||||
}
|
||||
check_mission_buf(){
|
||||
this.ap_max=(100+smc.vmdata.mission.ap)/100*this.ap
|
||||
@@ -491,17 +508,6 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
}
|
||||
exp_add(exp:number=0){
|
||||
if(this.box_group==BoxSet.HERO){
|
||||
smc.vmdata.mission.exp +=exp
|
||||
}
|
||||
if(this.box_group==BoxSet.MONSTER){
|
||||
smc.vmdata.mission.mexp +=exp
|
||||
}
|
||||
}
|
||||
power_add(p:number){
|
||||
this.pw+= p
|
||||
}
|
||||
//使用max_skill
|
||||
handle_skill(skill:number){
|
||||
this.as.max()
|
||||
@@ -599,9 +605,28 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
}
|
||||
|
||||
exp_add(exp:number=0){
|
||||
if(this.box_group==BoxSet.HERO){
|
||||
smc.vmdata.mission.exp +=exp
|
||||
}
|
||||
if(this.box_group==BoxSet.MONSTER){
|
||||
smc.vmdata.mission.mexp +=exp
|
||||
}
|
||||
}
|
||||
power_add(p:number){
|
||||
this.pw+= p
|
||||
}
|
||||
hp_max_add(){
|
||||
console.log("hp_max_add 动画");
|
||||
}
|
||||
add_ap(ap: number,time:number=0){
|
||||
this.ap += ap;
|
||||
}
|
||||
|
||||
add_shield(shield:number){
|
||||
this.shield =shield
|
||||
console.log("shield:",shield);
|
||||
}
|
||||
add_hp(hp: number=0){
|
||||
this.BUFFCOMP.heathed();
|
||||
this.hp+=hp;
|
||||
@@ -638,33 +663,6 @@ export class HeroViewComp extends CCComp {
|
||||
// }, 15);
|
||||
}
|
||||
}
|
||||
add_ap(ap: number,time:number=0){
|
||||
this.ap += ap;
|
||||
}
|
||||
check_atk_buffs(dt: number){
|
||||
for(let i=0;i<this.ap_buffs.length;i++){
|
||||
let buff=this.ap_buffs[i];
|
||||
buff.time -= dt;
|
||||
if(buff.time <= 0){
|
||||
this.ap_buff -= buff.ap
|
||||
this.ap_buffs.splice(i,1);
|
||||
}
|
||||
}
|
||||
if(this.ap_buffs.length <= 0){
|
||||
this.ap_buff = 0
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
buff_icon_change(icon:string,value:boolean){
|
||||
// this.node.getChildByName("top").getChildByName("buff").getChildByName(icon).active=value
|
||||
}
|
||||
add_shield(shield:number){
|
||||
this.shield =shield
|
||||
console.log("shield:",shield);
|
||||
}
|
||||
/** 静止时间 */
|
||||
in_stop (dt: number) {
|
||||
if(this.stop_cd > 0){
|
||||
|
||||
Reference in New Issue
Block a user