新hero 基本完成

This commit is contained in:
2024-09-11 08:02:49 +08:00
parent a10e2a43be
commit 0f7f2ad49b
21 changed files with 722 additions and 1796 deletions

View File

@@ -41,7 +41,9 @@ export class Hero extends ecs.Entity {
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!) {
var path = "game/monster/"+MonSet[uuid].path;
console.log("加载角色",uuid,smc.heros[uuid]);
var path = "game/hero/"+smc.heros[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent=layer
@@ -50,11 +52,11 @@ export class Hero extends ecs.Entity {
// node.setScale(node.scale.x*scale*ratio, node.scale.y*ratio, 0);
node.setPosition(pos)
this.hero_init(uuid,node)
oops.message.dispatchEvent("mon_load",this)
oops.message.dispatchEvent("hero_load",this)
}
set_ratio(uuid:number){
let ratio=1;
switch (MonSet[uuid].level) {
switch (smc.heros[uuid].level) {
case 2:
ratio=1.05
break;
@@ -76,18 +78,18 @@ export class Hero extends ecs.Entity {
var mv = node.getComponent(HeroViewComp)!;
var buff =node.getComponent(HeroBuffComp)!;
// console.log("hero_init",buff)
mv.speed =mv.ospeed = smc.monsters[uuid].speed;
mv.hero_name= smc.monsters[uuid].name;
buff.group=mv.box_group= BoxSet.MONSTER;
mv.hp= mv.hp_max = smc.monsters[uuid].hp;
mv.level = smc.monsters[uuid].level;
mv.atk = smc.monsters[uuid].atk;
mv.atk_cd = smc.monsters[uuid].atk_cd;
mv.power = smc.monsters[uuid].power;
mv.type = smc.monsters[uuid].type;
mv.speed =mv.ospeed = smc.heros[uuid].speed;
mv.hero_name= smc.heros[uuid].name;
buff.group=mv.box_group= BoxSet.HERO;
mv.hp= mv.hp_max = smc.heros[uuid].hp;
mv.level = smc.heros[uuid].level;
mv.atk = smc.heros[uuid].atk;
mv.atk_cd = smc.heros[uuid].atk_cd;
mv.power = smc.heros[uuid].power;
mv.type = smc.heros[uuid].type;
mv.skill_uuid = 9001;
mv.max_skill_uuid = smc.monsters[uuid].max_skill_uuid;
mv.scale = -1;
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
mv.scale = 1;
mv.Tpos = v3(0,0,0);
this.add(mv);
this.add(buff);