添加2个游戏层,敌方精灵随机出现在3个层内
This commit is contained in:
@@ -29,7 +29,7 @@ export class MapMonsterComp extends CCComp {
|
||||
cur_mission:number = 1; //当前关卡方案
|
||||
mission_list:any = []
|
||||
setp_timer: Timer = new Timer(0.5);
|
||||
setp_num:number = 50;
|
||||
setp_num:number = 5;
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||
@@ -40,7 +40,7 @@ export class MapMonsterComp extends CCComp {
|
||||
let num =RandomManager.instance.getRandomByObjectList(MissionNum,1)
|
||||
this.cur_mission = num[0]
|
||||
this.mission_list = MonsetList[this.cur_mission]
|
||||
console.log("当前关卡方案",this.cur_mission,this.mission_list)
|
||||
// console.log("当前关卡方案",this.cur_mission,this.mission_list)
|
||||
this.refresh_timer= new Timer(smc.vm_data.gold.cd);
|
||||
this.monster_refresh()
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export class MapMonsterComp extends CCComp {
|
||||
this.monster_refresh()
|
||||
}
|
||||
if (this.refresh_timer.update(dt)) {
|
||||
this.setp_num = RandomManager.instance.getRandomInt(this.min_monster_num,this.max_monster_num,2)
|
||||
// this.setp_num = RandomManager.instance.getRandomInt(this.min_monster_num,this.max_monster_num,2)
|
||||
}
|
||||
if (this.mission_up_timer.update(dt)) {
|
||||
// 刷新怪物定时器
|
||||
@@ -64,22 +64,36 @@ export class MapMonsterComp extends CCComp {
|
||||
if (this.setp_num <= 0){
|
||||
return
|
||||
}
|
||||
console.log("当前波数",this.cur_count)
|
||||
console.log("当前怪物池",this.mission_list[this.monster_level])
|
||||
// console.log("当前波数",this.cur_count)
|
||||
// console.log("当前怪物池",this.mission_list[this.monster_level])
|
||||
let m:any = RandomManager.instance.getRandomByObjectList(this.mission_list[this.monster_level],1)
|
||||
console.log("刷怪",m)
|
||||
// console.log("刷怪",m)
|
||||
this.addMonster(m[0])
|
||||
this.setp_num -= 1
|
||||
}
|
||||
private addMonster(uuid:number=1101) {
|
||||
|
||||
let monster = ecs.getEntity<Monster>(Monster);
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||
let scale = -1
|
||||
monster.load(pos,scale,uuid);
|
||||
var scene = smc.map.MapView.scene;
|
||||
let x = RandomManager.instance.getRandomInt(0,2, 2);
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
switch (x) {
|
||||
case 1:
|
||||
monster_layer = scene.entityLayer1!.node!;
|
||||
pos.y=pos.y+5;
|
||||
break;
|
||||
case 2:
|
||||
monster_layer= scene.entityLayer2!.node!;
|
||||
pos.y=pos.y-5;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
monster.load(pos,scale,uuid,monster_layer);
|
||||
smc.monsters.splice(0,1)
|
||||
|
||||
}
|
||||
|
||||
private on_do_add_monster(event: string, args: any) {
|
||||
// this.addMonster(args.uuid)
|
||||
}
|
||||
|
||||
@@ -29,12 +29,11 @@ export class MapSkillComp extends CCComp {
|
||||
csk.load(pos,scale,uuid);
|
||||
}
|
||||
doMonsterLoad(){
|
||||
// const light = instantiate(this.light);
|
||||
// light.setPosition(300,-30,0);
|
||||
// this.node.addChild(light);
|
||||
const light = instantiate(this.light);
|
||||
light.setPosition(BoxSet.MONSTER_START,BoxSet.GAME_LINE);
|
||||
this.node.addChild(light);
|
||||
}
|
||||
doHeroLoad(){
|
||||
console.log(this.light)
|
||||
const light = instantiate(this.light);
|
||||
light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
|
||||
this.node.addChild(light);
|
||||
|
||||
@@ -2,7 +2,6 @@ import { v3, Vec3, _decorator ,Prefab,instantiate,JsonAsset} 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 { smc } from "../../common/SingletonModuleComp";
|
||||
// import { Role } from "../../role/Role";
|
||||
import { BoxSet } from "../../common/config/BoxSet";
|
||||
import { Hero } from "../../monster/Hero";
|
||||
import { Monster } from "../../monster/Monster";
|
||||
@@ -12,7 +11,6 @@ import { Timer } from "../../../../../extensions/oops-plugin-framework/assets/co
|
||||
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { CardSet } from "../../common/config/CardSet";
|
||||
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MapViewComp')
|
||||
@@ -42,6 +40,10 @@ export class MapViewComp extends CCComp {
|
||||
start() {
|
||||
this.scene = this.getComponent(MapViewScene);
|
||||
this.load_data()
|
||||
this.load_role()
|
||||
}
|
||||
load_role(){
|
||||
|
||||
}
|
||||
load_data(){
|
||||
// let heros = oops.res.get("config/game/heros")
|
||||
|
||||
@@ -28,6 +28,10 @@ export class MapViewScene extends Component {
|
||||
|
||||
@property(EntityLayer)
|
||||
public entityLayer: EntityLayer | null = null;
|
||||
@property(EntityLayer)
|
||||
public entityLayer1: EntityLayer | null = null;
|
||||
@property(EntityLayer)
|
||||
public entityLayer2: EntityLayer | null = null;
|
||||
|
||||
@property(SkillLayer)
|
||||
public SkillLayer: SkillLayer | null = null;
|
||||
|
||||
@@ -26,7 +26,7 @@ export default class EntityLayer extends Component {
|
||||
}
|
||||
|
||||
protected start(): void {
|
||||
console.log("EntityLayer start")
|
||||
console.log("EntityLayer start",this)
|
||||
}
|
||||
|
||||
public clear() {
|
||||
|
||||
Reference in New Issue
Block a user