This commit is contained in:
2024-11-13 08:14:10 +08:00
parent 220f595ff6
commit 3f8cf727d9
16 changed files with 1680 additions and 106 deletions

View File

@@ -82,7 +82,7 @@ export class MapMonsterComp extends CCComp {
}
if(this.setp_timer.update(dt)){
if(this.total<=0) return
// this.monster_refresh()
this.monster_refresh()
}
if(this.call_hero_timer.update(dt)){
if(this.hero_total <= 0) return
@@ -90,7 +90,7 @@ export class MapMonsterComp extends CCComp {
}
if(this.boss_timer.update(dt)){
if(this.boss_num <=0 ) return
this.load_boss()
// this.load_boss()
}
this.is_reward()
if (this.refresh_timer.update(dt)) {
@@ -122,7 +122,6 @@ export class MapMonsterComp extends CCComp {
this.hero_x=0
this.hero_index=0
smc.vm_data.mission.coin = 0
// this.load_role()
}
on_mon_dead(){
let coin =(GameSet.MON_COIN_ADD*smc.vm_data.mission.coin_reward_add*(1+Talents[1006].bonus*smc.vm_data.talent[1006].lv)).toFixed(0)
@@ -190,10 +189,11 @@ export class MapMonsterComp extends CCComp {
count_mon_pos(){
let monsters:any= ecs.query(ecs.allOf(MonModelComp));
for(let i=0;i<monsters.length;i++){
if(monsters[i].MonView == undefined) return
let mon:any = monsters[i].MonView.node.position
if(monsters[i].HeroView == undefined) return
let mon:any = monsters[i].HeroView.node.position
smc.enemy_pos[i].x= mon.x
}
console.log("count_mon_pos",smc.enemy_pos);
}
count_hero_pos(){
let heros:any= ecs.query(ecs.allOf(HeroModelComp));
@@ -202,15 +202,9 @@ export class MapMonsterComp extends CCComp {
let ho:any = heros[i].HeroView.node.position
smc.hero_pos[i].x= ho.x
}
// console.log("count_hero_pos",smc.hero_pos);
}
load_role(){
let role = ecs.getEntity<Role>(Role);
let pos = v3(BoxSet.HERO_START-100,BoxSet.GAME_LINE-5)
role.load(pos,109)
smc.Role=role
// console.log("加载玩家",role)
console.log("count_hero_pos",smc.hero_pos);
}
private on_do_add_hero(event: string, args: any) {
this.addHero(args.uuid)
}

View File

@@ -41,15 +41,7 @@ export class MapSkillComp extends CCComp {
}
useItem(event: string, args: any){
console.log("useItem");
if(smc.sitems[args.uuid].hp > 0){ //buff加血
smc.Role.RoleView.add_hp(smc.sitems[args.uuid].hp)
}
if(smc.sitems[args.uuid].atk > 0){ //buff加攻击
smc.Role.RoleView.add_atk(smc.sitems[args.uuid].atk,smc.sitems[args.uuid].sd)
}
if(smc.sitems[args.uuid].shield > 0){ //buff护盾
smc.Role.RoleView.add_shield(smc.sitems[args.uuid].shield,smc.sitems[args.uuid].sd)
}
}
/** 视图层逻辑代码分离演示 */
start() {