下一步:怪物路线设置

This commit is contained in:
2024-09-18 14:18:23 +08:00
parent 839ccba3de
commit 2ab7279b04
5 changed files with 20 additions and 34 deletions

View File

@@ -93,7 +93,7 @@ export class RoleViewComp extends CCComp {
is_atking:boolean = false; is_atking:boolean = false;
onLoad() { onLoad() {
this.BoxRang = this.node.getChildByName("range_box"); // this.BoxRang = this.node.getChildByName("range_box");
this.as = this.node.getComponent(RoleSpine); this.as = this.node.getComponent(RoleSpine);
} }
@@ -110,8 +110,8 @@ export class RoleViewComp extends CCComp {
this.BoxRang.getComponent(RoleRangComp).box_group = this.box_group; // this.BoxRang.getComponent(RoleRangComp).box_group = this.box_group;
this.BoxRang.getComponent(RoleRangComp).atk_range = this.atk_range // this.BoxRang.getComponent(RoleRangComp).atk_range = this.atk_range
// this.BoxRang.getComponent(RoleRangComp).offset_x = this.scale*smc.skills[this.skill_uuid].dis/3; // this.BoxRang.getComponent(RoleRangComp).offset_x = this.scale*smc.skills[this.skill_uuid].dis/3;
// console.log("monseter ",this.BoxRang); // console.log("monseter ",this.BoxRang);

View File

@@ -48,8 +48,8 @@ export class Hero extends ecs.Entity {
// var as = node.getComponent(HeroSpine); // var as = node.getComponent(HeroSpine);
// let ratio=this.set_ratio(uuid); // let ratio=this.set_ratio(uuid);
// node.setScale(node.scale.x*scale*ratio, node.scale.y*ratio, 0); // node.setScale(node.scale.x*scale*ratio, node.scale.y*ratio, 0);
pos.x=smc.Role.RoleView.node.position.x+pos.x; // pos.x=smc.Role.RoleView.node.position.x+pos.x;
pos.y=smc.Role.RoleView.node.position.y+pos.y; // pos.y=smc.Role.RoleView.node.position.y+pos.y;
node.setPosition(pos) node.setPosition(pos)
this.hero_init(uuid,node,index) this.hero_init(uuid,node,index)
oops.message.dispatchEvent("hero_load",this) oops.message.dispatchEvent("hero_load",this)

View File

@@ -185,12 +185,12 @@ export class HeroViewComp extends CCComp {
if(this.stop_cd > 0){ if(this.stop_cd > 0){
return return
} }
if (this.scale === 1 && this.node.position.x >= BoxSet.MONSTER_START-150) { if (this.node.position.x >= 250-this.atk_dis) {
return; return;
} }
if(this.enemy){ // if(this.enemy){
return // return
} // }
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z); this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z);
} }
hp_show(){ hp_show(){
@@ -407,7 +407,7 @@ export class HeroViewComp extends CCComp {
if(this.hp <= 0){ if(this.hp <= 0){
this.dead(); this.dead();
this.is_dead = true; this.is_dead = true;
smc.role_heros[this.role_heros_index].eid == 0 // smc.role_heros[this.role_heros_index].eid == 0
setTimeout(() => { setTimeout(() => {
this.ent.destroy(); this.ent.destroy();
}, 15); }, 15);

View File

@@ -97,26 +97,12 @@ export class MapMonsterComp extends CCComp {
private addHero(uuid:number=1001) { private addHero(uuid:number=1001) {
let hero = ecs.getEntity<Hero>(Hero); let hero = ecs.getEntity<Hero>(Hero);
var scene = smc.map.MapView.scene; var scene = smc.map.MapView.scene;
let oy=RandomManager.instance.getRandomInt(-70,70,1) let oy=RandomManager.instance.getRandomByObjectList(this.start_ys,1)
let pos = v3(0,0); let pos:Vec3 = v3(-280,BoxSet.GAME_LINE+oy[0]);
let less=0
let index =0
for(let i=0; i <= 11;i++){
if(smc.role_heros[i].eid==0){
pos=v3(smc.role_heros[i].x,smc.role_heros[i].y)
less += 1
index = i
smc.role_heros[i].eid=hero.eid
break
}
}
if(less <= 0){
oops.gui.toast("人数已满");
return false
}
let monster_layer = scene.entityLayer!.node! let monster_layer = scene.entityLayer!.node!
let scale = 1 let scale = 1
hero.load(pos,scale,uuid,monster_layer,index); hero.load(pos,scale,uuid,monster_layer);
} }
monster_refresh(){ monster_refresh(){
if (this.setp_num <= 0){ if (this.setp_num <= 0){

View File

@@ -30,14 +30,14 @@ export class MapSkillComp extends CCComp {
} }
doMonsterLoad(){ doMonsterLoad(){
const light = instantiate(this.light); // const light = instantiate(this.light);
light.setPosition(BoxSet.MONSTER_START,BoxSet.GAME_LINE); // light.setPosition(BoxSet.MONSTER_START,BoxSet.GAME_LINE);
this.node.addChild(light); // this.node.addChild(light);
} }
doHeroLoad(){ doHeroLoad(){
const light = instantiate(this.light); // const light = instantiate(this.light);
light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0); // light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
this.node.addChild(light); // this.node.addChild(light);
} }
useItem(event: string, args: any){ useItem(event: string, args: any){
console.log("useItem"); console.log("useItem");