dd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { _decorator ,Vec3,v3} from "cc";
|
||||
import { _decorator ,Vec3,v3, Prefab, instantiate,Node} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
@@ -40,6 +40,11 @@ export class MapMonsterComp extends CCComp {
|
||||
hero_start_ys:any[] = [35,-35];
|
||||
mon_index:number = 0
|
||||
hero_index:number = 0
|
||||
|
||||
|
||||
@property(Node)
|
||||
start_p: Node = null;
|
||||
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("other_add_monster", this.on_other_add_monster, this);
|
||||
@@ -49,6 +54,9 @@ export class MapMonsterComp extends CCComp {
|
||||
// this.scene = this.getComponent(MapViewScene);
|
||||
// this.scene.node.active = true
|
||||
// this.scene = this.getComponent(MapViewScene);
|
||||
var scene = smc.map.MapView.scene;
|
||||
this.start_p.parent=scene.mapLayer!.node!
|
||||
this.set_start_point()
|
||||
let num =RandomManager.instance.getRandomByObjectList(MissionNum,1)
|
||||
this.cur_mission = num[0]
|
||||
this.mission_list = MonsetList[this.cur_mission]
|
||||
@@ -58,6 +66,7 @@ export class MapMonsterComp extends CCComp {
|
||||
this.load_role()
|
||||
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
if(smc.vm_data.game_over){
|
||||
return
|
||||
@@ -79,6 +88,9 @@ export class MapMonsterComp extends CCComp {
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
}
|
||||
set_start_point(){
|
||||
this.start_p.setPosition(-240,BoxSet.GAME_LINE+this.start_ys[this.hero_index]+30,0)
|
||||
}
|
||||
check_mon_count(){
|
||||
let count = 0;
|
||||
let list = ecs.query(ecs.allOf(MonModelComp));
|
||||
@@ -149,7 +161,7 @@ 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(-280,BoxSet.GAME_LINE+this.start_ys[this.hero_index]);
|
||||
let pos:Vec3 = v3(-240,BoxSet.GAME_LINE+this.start_ys[this.hero_index]);
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
let scale = 1
|
||||
hero.load(pos,scale,uuid,monster_layer);
|
||||
@@ -157,6 +169,7 @@ export class MapMonsterComp extends CCComp {
|
||||
if(this.hero_index > 2){
|
||||
this.hero_index = 0
|
||||
}
|
||||
this.set_start_point()
|
||||
}
|
||||
monster_refresh(){
|
||||
if (this.setp_num <= 0){
|
||||
|
||||
Reference in New Issue
Block a user