dd
This commit is contained in:
@@ -21,24 +21,18 @@ export class MapViewComp extends CCComp {
|
||||
scene: MapViewScene = null!;
|
||||
current_map: any;
|
||||
private game_timer: Timer = new Timer(1);
|
||||
private monster_refresh_rtimer: Timer = new Timer(3);
|
||||
|
||||
|
||||
private mapLoaded() {
|
||||
|
||||
}
|
||||
async onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||
oops.message.on("do_add_hero", this.on_do_add_hero, this);
|
||||
|
||||
}
|
||||
private on_do_add_monster(event: string, args: any) {
|
||||
this.addMonster()
|
||||
}
|
||||
|
||||
/**监听do_add_hero 添加hero,通过uuid */
|
||||
private on_do_add_hero(event: string, args: any) {
|
||||
console.log("do_add_hero",args.uuid)
|
||||
// console.log("do_add_hero",args.uuid)
|
||||
this.addHero(args.uuid)
|
||||
}
|
||||
reset(): void {
|
||||
@@ -54,22 +48,15 @@ export class MapViewComp extends CCComp {
|
||||
// console.log("heros",heros)
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if (this.monster_refresh_rtimer.update(dt)) {
|
||||
// 刷新怪物定时器
|
||||
this.monster_refresh()
|
||||
}
|
||||
if (this.game_timer.update(dt)) {
|
||||
smc.vm_data.game.g_time += 1;
|
||||
}
|
||||
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vm_data.game.g_time += 1;
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
this.gold_add(dt)
|
||||
}
|
||||
// 刷新怪物
|
||||
monster_refresh(){
|
||||
if(smc.monsters.length > 0 ){
|
||||
this.addMonster(smc.monsters[0].uuid)
|
||||
}
|
||||
}
|
||||
|
||||
gold_add(dt: number) {
|
||||
smc.vm_data.gold.time += dt;
|
||||
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
|
||||
@@ -94,13 +81,6 @@ export class MapViewComp extends CCComp {
|
||||
let camp = 1
|
||||
hero.load(pos,camp,uuid);
|
||||
}
|
||||
private addMonster(uuid:number=1001) {
|
||||
this.scene.node.active = true
|
||||
let monster = ecs.getEntity<Monster>(Monster);
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||
let camp = -1
|
||||
monster.load(pos,camp,uuid);
|
||||
smc.monsters.splice(0,1)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user