This commit is contained in:
2024-10-15 08:51:10 +08:00
parent 74ad696f05
commit 46fd88d75a
145 changed files with 61861 additions and 2329 deletions

View File

@@ -108,6 +108,7 @@ export class RoleViewComp extends CCComp {
// this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
// 注册单个碰撞体的回调函数
let collider = this.getComponent(Collider2D);
smc.vm_data.role.atk_time=smc.vm_data.role.atk_cd;
collider.group = this.box_group;
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
@@ -181,7 +182,7 @@ export class RoleViewComp extends CCComp {
this.check_buff_atks(dt)
this.in_shield(dt);
this.in_stop(dt);
this.atk_time += dt;
smc.vm_data.role.atk_time -= dt;
this.in_atk();
this.skill_cds(dt);
this.move(dt);
@@ -197,27 +198,27 @@ export class RoleViewComp extends CCComp {
if(this.skill1.cd <= 0){
this.handle_skill(this.skill1.uuid);
this.skill1.cd=this.skill1.cd_max
console.log("shoot uuid :"+this.skill1.uuid);
console.log("shoot skill1 uuid :"+this.skill1.uuid);
}
if(this.skill2.cd <= 0){
this.handle_skill(this.skill2.uuid);
this.skill2.cd=this.skill2.cd_max
console.log("shoot uuid :"+this.skill2.uuid);
console.log("shoot skill2 uuid :"+this.skill2.uuid);
}
if(this.skill3.cd <= 0){
this.handle_skill(this.skill3.uuid);
this.skill3.cd=this.skill3.cd_max
console.log("shoot uuid :"+this.skill3.uuid);
console.log("shoot skill3 uuid :"+this.skill3.uuid);
}
if(this.skill4.cd <= 0){
this.handle_skill(this.skill4.uuid);
this.skill4.cd=this.skill4.cd_max
console.log("shoot uuid :"+this.skill4.uuid);
console.log("shoot skill4 uuid :"+this.skill4.uuid);
}
if(this.skill5.cd <= 0){
this.handle_skill(this.skill5.uuid);
this.skill5.cd=this.skill5.cd_max
console.log("shoot uuid :"+this.skill5.uuid);
console.log("shoot skill5 uuid :"+this.skill5.uuid);
}
// this.skills.forEach((e:any) => {
// if(e.cd > 0&&e.alive){
@@ -235,7 +236,7 @@ export class RoleViewComp extends CCComp {
// console.log("handle_skill uuid:"+uuid);
this.as.max();
this.scheduleOnce(()=>{
this.shoot(this.skill);
this.shoot(uuid);
},0.3)
}
// check_enemys(){
@@ -294,16 +295,19 @@ export class RoleViewComp extends CCComp {
return {pos,t_pos}
}
check_enemy_alive(){
let dir = 320
let dir = 360
this.enemy = v3(720,this.node.position.y)
for (let i = 0; i < GameSet.ATK_LINES; i++) {
let mon:any = smc.enemy_pos[i];
let x=Math.abs(mon.x-this.node.position.x)
let y = Math.abs(mon.y-this.node.position.y)
let squaredDistance =x*x+y*y
let distance = Math.sqrt(squaredDistance);
if(distance < dir){
dir = distance
// let x=Math.abs(mon.x-this.node.position.x)
// let y = Math.abs(mon.y-this.node.position.y)
// let squaredDistance =x*x+y*y
// let distance = Math.sqrt(squaredDistance);
// if(distance < dir){
// dir = distance
// this.enemy = mon
// }
if(mon.x < this.enemy.x){
this.enemy = mon
}
}
@@ -314,16 +318,16 @@ export class RoleViewComp extends CCComp {
}
}
in_atk() {
if(this.atk_time >= this.atk_cd){
if(smc.vm_data.role.atk_time <= 0 ){
if(this.is_atking){
this.atk_time = 0;
// console.log("atk_cd:"+this.atk_cd);
smc.vm_data.role.atk_time = smc.vm_data.role.atk_cd;
console.log("atk_cd:"+smc.vm_data.role.atk_cd);
this.as.atk();
this.scheduleOnce(()=>{
this.shoot(this.skill,-30);
this.shoot(this.skill,0,30);
},0.4)
}
// this.atk_time = 0;
// smc.vm_data.role.atk_time = 0;
// this.as.atk();
// this.scheduleOnce(()=>{
// this.shoot(this.skill,-30,45);