dd
This commit is contained in:
@@ -99,7 +99,7 @@ export class HeroViewComp extends CCComp {
|
||||
role_heros_index:number = -1;
|
||||
anm_timer:Timer = new Timer(2);
|
||||
anm_name="idle"
|
||||
|
||||
status:String = "idle"
|
||||
onLoad() {
|
||||
this.as = this.getComponent(HeroSpine);
|
||||
// this.BoxRang = this.node.getChildByName("range_box");
|
||||
@@ -124,10 +124,7 @@ export class HeroViewComp extends CCComp {
|
||||
// this.BoxRang.getComponent(BoxRangComp).offset_x = 300;
|
||||
// console.log("monseter ",this.BoxRang);
|
||||
// console.log("monseter ",this.BoxRang);
|
||||
// if(this.box_group == BoxSet.MON){
|
||||
// this.enemy=smc.Role.RoleView.node
|
||||
// // console.log("mon enemy ",this.enemy);
|
||||
// }
|
||||
|
||||
// 注册单个碰撞体的回调函数
|
||||
let collider = this.getComponent(Collider2D);
|
||||
collider.group = this.box_group;
|
||||
@@ -185,7 +182,15 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
}
|
||||
|
||||
status_change(type:string){
|
||||
if(this.status == type) return
|
||||
this.status=type
|
||||
if(type != "move"){
|
||||
this.as.change_default("idle")
|
||||
}else{
|
||||
this.as.change_default("move")
|
||||
}
|
||||
}
|
||||
|
||||
update(dt: number){
|
||||
if(!smc.vm_data.mission.play||smc.vm_data.pause){
|
||||
@@ -194,18 +199,18 @@ export class HeroViewComp extends CCComp {
|
||||
if (this.timer.update(dt)) {
|
||||
this.power_change(this.power_speed)
|
||||
}
|
||||
if(this.anm_timer.update(dt)) {
|
||||
this.change_anm()
|
||||
}
|
||||
// this.in_destroy();
|
||||
// this.check_buff_atks(dt)
|
||||
// this.in_shield(dt);
|
||||
// this.in_stop(dt);
|
||||
// this.atk_time += dt;
|
||||
// this.check_enemy_alive()
|
||||
// this.in_atk(dt);
|
||||
// this.hp_show()
|
||||
// this.move(dt);
|
||||
// if(this.anm_timer.update(dt)) {
|
||||
// this.change_anm()
|
||||
// }
|
||||
this.in_destroy();
|
||||
this.check_buff_atks(dt)
|
||||
this.in_shield(dt);
|
||||
this.in_stop(dt);
|
||||
this.atk_time += dt;
|
||||
this.check_enemy_alive()
|
||||
this.in_atk(dt);
|
||||
this.hp_show()
|
||||
this.move(dt);
|
||||
|
||||
|
||||
// this.in_speek(dt);
|
||||
@@ -266,8 +271,11 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
move(dt: number){
|
||||
if(this.stop_cd > 0){
|
||||
this.as.idle()
|
||||
this.status_change("idle")
|
||||
return
|
||||
}
|
||||
if (this.node.position.x >= 360 && this.scale==1) {
|
||||
@@ -276,11 +284,14 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.scale===-1&&this.node.position.x <= -360){
|
||||
return;
|
||||
}
|
||||
this.as.move()
|
||||
this.status_change("move")
|
||||
// if(this.enemy){
|
||||
// return
|
||||
// }
|
||||
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z);
|
||||
}
|
||||
|
||||
hp_show(){
|
||||
if(this.hp == this.hp_max){
|
||||
this.node.getChildByName("top").getChildByName("hp").active = false;
|
||||
@@ -397,13 +408,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
}
|
||||
if(t_hero){ //血量最少单体
|
||||
if(smc.Role.RoleView){
|
||||
let role_hp=smc.Role.RoleView.hp_max-smc.Role.RoleView.hp
|
||||
if(role_hp > least_hp){
|
||||
least_hp = role_hp
|
||||
t_hero = smc.Role.RoleView
|
||||
}
|
||||
}
|
||||
|
||||
this.to_add_buff(t_hero,skill)
|
||||
}
|
||||
|
||||
@@ -453,10 +458,10 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
|
||||
in_atk(dt: number) {
|
||||
if(this.atk_time >= this.atk_cd/smc.vm_data.mission.hero.atk_cd){
|
||||
if(this.atk_time >= this.atk_cd){
|
||||
if(this.is_atking){
|
||||
this.atk_time = 0;
|
||||
// console.log("atk_cd:"+this.atk_cd);
|
||||
console.log("atk_cd:"+this.atk_cd);
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.handle_skill(this.skill_uuid)
|
||||
|
||||
Reference in New Issue
Block a user