This commit is contained in:
2024-07-30 10:55:31 +08:00
parent 76b400885c
commit d85ed9e6b6
13 changed files with 663 additions and 55 deletions

View File

@@ -15,7 +15,8 @@ const { ccclass, property } = _decorator;
@ecs.register('MapView', false)
export class MapViewComp extends CCComp {
scene: MapViewScene = null!;
@property(Prefab)
boss: Prefab = null!;
/** 是否正在转场 */
@@ -23,7 +24,7 @@ export class MapViewComp extends CCComp {
current_map: any;
/** 转场碰撞点对象集合 */
private timer: Timer = new Timer(2);
private timer: Timer = new Timer(3);
onLoad(){
// 监听全局事件
oops.message.on("monster_load", this.onMonsterLoaded, this);
@@ -63,18 +64,12 @@ export class MapViewComp extends CCComp {
}
if (smc.monsters.length>0){
var path = "game/monster/monster";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!;
node.setPosition(v3(360,-60))
this.node.addChild(node);
// let monster = ecs.getEntity<Monster>(Monster);
// monster.load(v3(360,-60),smc.monsters[0].speed);
// monster.move(v3(0,-60));
// smc.monsters.splice(0,1)
let monster = ecs.getEntity<Monster>(Monster);
monster.load(v3(360,-60),smc.monsters[0].speed);
monster.move(v3(0,-60));
smc.monsters.splice(0,1)
}
}