hero 根据type 确定出生点

This commit is contained in:
2024-11-15 09:38:36 +08:00
parent d632513701
commit 425a8bac64
6 changed files with 44 additions and 38 deletions

View File

@@ -17,6 +17,7 @@ import { Boss} from "../Boss/Boss";
import { UIID } from "../common/config/GameUIConfig";
import { Talents } from "../common/config/TalentSet";
import { HeroViewComp } from "../hero/HeroViewComp";
import { HeroSet } from "../common/config/heroSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -159,10 +160,7 @@ export class MapMonsterComp extends CCComp {
return
}
let m:any = RandomManager.instance.getRandomByObjectList(this.mission_list[this.monster_level],1)
var scene = smc.map.MapView.scene;
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
let monster_layer = scene.entityLayer!.node!
this.addMonster(m[0],monster_layer,pos)
this.addMonster(m[0])
this.mon_index += 1
if(this.mon_index>2){
this.mon_index = 0
@@ -184,7 +182,7 @@ export class MapMonsterComp extends CCComp {
var scene = smc.map.MapView.scene;
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
let monster_layer = scene.entityLayer!.node!
this.addMonster(args.uuid,monster_layer,pos)
this.addMonster(args.uuid)
}
set_start_point(){
// this.start_p.setPosition(-240,BoxSet.GAME_LINE+this.start_ys[this.hero_index]+30,0)
@@ -218,18 +216,17 @@ export class MapMonsterComp extends CCComp {
/** 添加玩家 */
private addHero(uuid:number=1001) {
let hero = ecs.getEntity<Hero>(Hero);
var scene = smc.map.MapView.scene;
let pos:Vec3 = v3(-210-this.hero_x*30,BoxSet.GAME_LINE);
let monster_layer = scene.entityLayer!.node!
let scale = 1
hero.load(pos,scale,uuid,monster_layer);
let pos:Vec3 = v3(HeroSet[smc.heros[uuid].type],BoxSet.GAME_LINE);
hero.load(pos,scale,uuid);
this.set_start_point()
}
private addMonster(uuid:number=1001,layer:any,pos:Vec3=v3(0,0,0)) {
private addMonster(uuid:number=1001) {
let monster = ecs.getEntity<Hero>(Hero);
let scale = -1
let index = -1
monster.load(pos,scale,uuid,layer,index,false);
let pos:Vec3 = v3(-1*HeroSet[smc.heros[uuid].type],BoxSet.GAME_LINE);
monster.load(pos,scale,uuid,index,false);
}
load_boss(){