dd
This commit is contained in:
@@ -42,21 +42,21 @@ export class Role extends ecs.Entity {
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101) {
|
||||
// var path = "game/monster/"+prefab_path;
|
||||
var path = "game/heros/hero";
|
||||
var path = "game/heros/role";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!;
|
||||
node.setScale(1.5*node.scale.x, 1.5*node.scale.y, node.scale.z);
|
||||
// var as = node.getComponent(MonsterSpine);
|
||||
node.setPosition(pos)
|
||||
console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
||||
const url = 'game/heros/player';
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
// node.setPosition(pos)
|
||||
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
||||
// const url = 'game/heros/player';
|
||||
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
// const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(RoleSet[uuid].path);
|
||||
});
|
||||
// sprite.spriteFrame = atlas.getSpriteFrame(RoleSet[uuid].path);
|
||||
// });
|
||||
// var rv = node.getComponent(MonsterViewComp)!;
|
||||
// this.add(rv);
|
||||
this.hero_init(uuid,node)
|
||||
|
||||
Reference in New Issue
Block a user