dd
This commit is contained in:
@@ -149,6 +149,7 @@ export class MonViewComp extends CCComp {
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
this.stop_cd = 0.1;
|
||||
this.is_atking=true
|
||||
|
||||
}
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {}
|
||||
@@ -177,15 +178,17 @@ export class MonViewComp extends CCComp {
|
||||
}
|
||||
check_enemy_alive(){
|
||||
let dir = 320
|
||||
this.enemy = v3(720,this.node.position.y)
|
||||
for (let i = 0; i < GameSet.ATK_LINES; i++) {
|
||||
let hero:any = smc.hero_pos[i];
|
||||
let x=Math.abs(hero.x-this.node.position.x)
|
||||
let y = Math.abs(hero.y-this.node.position.y)
|
||||
|
||||
let ho:any = smc.hero_pos[i];
|
||||
let x=Math.abs(ho.x-this.node.position.x)
|
||||
let y = Math.abs(ho.y-this.node.position.y)
|
||||
let squaredDistance =x*x+y*y
|
||||
let distance = Math.sqrt(squaredDistance);
|
||||
if(distance < dir){
|
||||
dir = distance
|
||||
this.enemy = hero
|
||||
this.enemy = ho
|
||||
}
|
||||
|
||||
}
|
||||
@@ -280,14 +283,12 @@ export class MonViewComp extends CCComp {
|
||||
if(this.atk_time >= this.atk_cd){
|
||||
if(this.is_atking){
|
||||
this.atk_time = 0;
|
||||
// console.log("atk_cd:"+this.atk_cd);
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
console.log("mon skill_cd:"+this.skill_uuid);
|
||||
this.shoot(this.skill_uuid);
|
||||
},0.4)
|
||||
}
|
||||
}else{
|
||||
this.atk_time += dt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user