dd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { v3, Vec3, _decorator } from "cc";
|
||||
import { v3, Vec3, _decorator ,Prefab,instantiate} 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";
|
||||
@@ -56,19 +56,25 @@ export class MapViewComp extends CCComp {
|
||||
private addHero() {
|
||||
|
||||
this.scene.node.active = true
|
||||
// smc.monsters = ['war','magic','heath']
|
||||
// smc.heros = ['war','magic','heath']
|
||||
if (smc.heros.length>0){
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
hero.load(v3(-360,-60), smc.heros[0].profession);
|
||||
|
||||
smc.heros.splice(0,1)
|
||||
}
|
||||
|
||||
if (smc.monsters.length>0){
|
||||
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)
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user