This commit is contained in:
2024-08-23 13:26:26 +08:00
parent 75f0677b88
commit 97875dfe2b
10 changed files with 286 additions and 43 deletions

View File

@@ -34,17 +34,16 @@ export class Role extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=101) {
load(uuid:number=101) {
// var path = "game/monster/"+prefab_path;
var path = "game/heros/role";
let pos: Vec3 = Vec3.ZERO
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!;
// var as = node.getComponent(MonsterSpine);
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
node.setPosition(pos)
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
const url = 'game/heros/player';
@@ -59,7 +58,7 @@ export class Role extends ecs.Entity {
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
var rv = node.getComponent(RoleViewComp)!;
this.add(rv);
}