role 也转为使用hero 预制体

This commit is contained in:
2024-09-02 17:15:30 +08:00
parent 83bd06334f
commit 8b9c04eae3
15 changed files with 299 additions and 223 deletions

View File

@@ -38,16 +38,12 @@ export class Hero extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001) {
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!) {
// var path = "game/monster/"+prefab_path;
var path = "game/heros/hero";
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.parent=layer
let ratio=this.set_ratio(uuid);
node.setScale(ratio*node.scale.x, ratio*node.scale.y, node.scale.z);
@@ -76,8 +72,8 @@ export class Hero extends ecs.Entity {
ratio=1.3
break;
case 5:
ratio=1.4
break;
ratio=1.4
break;
default:
ratio=1
}