位置已取消

This commit is contained in:
2025-05-15 16:51:52 +08:00
parent ea64303410
commit 30d5cfbb7c
3 changed files with 13 additions and 14 deletions

View File

@@ -51,39 +51,36 @@ export class MissionHeroCompComp extends CCComp {
call_hero(event: string, args: any){
this.node.getChildByName("herospos").active=false
console.log("call_hero",args)
let hero_pos=0
if(args.hero_pos){
hero_pos=args.hero_pos
}
let fight_pos=args
this.timer.reset()
let hero_list =HeroList
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
// let uuid=args.uuid
// console.log("call_hero",uuid)
this.addHero(this.current_hero_uuid,hero_pos)
this.addHero(this.current_hero_uuid,fight_pos)
}
/** 添加玩家 */
private addHero(uuid:number=1001,hero_pos:number=0) {
private addHero(uuid:number=1001,fight_pos:number=0) {
console.log("call_hero addHero",uuid)
let info:any={ap:0,hp:0}
if(this.start_pos[hero_pos].has){
info=this.get_info_and_remove(hero_pos,uuid)
if(this.start_pos[fight_pos].has){
info=this.get_info_and_remove(fight_pos,uuid)
}
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
let pos:Vec3 = this.start_pos[hero_pos].pos;
let pos:Vec3 = this.start_pos[fight_pos].pos;
console.log("hero load0",pos,this.start_pos)
hero.load(pos,scale,uuid,info);
this.start_pos[hero_pos].has=true
hero.load(pos,scale,uuid,info,fight_pos);
this.start_pos[fight_pos].has=true
this.current_hero_uuid=0
}
get_info_and_remove(type:number,uuid:number){
get_info_and_remove(fight_pos:number,uuid:number){
let info:any={ap:0,hp:0}
let heros=ecs.query(ecs.allOf(HeroModelComp))
for(let hero of heros){
if(hero.get(HeroViewComp).type==type){
if(hero.get(HeroViewComp).fight_pos==fight_pos){
let hv = hero.get(HeroViewComp)
let AP_UP_RATE = hv.hero_uuid === uuid ? GameSet.AP_UPDATE_RATE : GameSet.AP_CHANGE_RATE;
let heroUpData = HeroUpInfo[hv.hero_uuid] || {}