假期修改
This commit is contained in:
@@ -17,6 +17,8 @@ import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { HeroSet,MonSet } from "../common/config/heroSet";
|
||||
import { Role } from "../Role/Role";
|
||||
import { MoveToComp } from "../common/ecs/position/MoveTo";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Hero`)
|
||||
export class Hero extends ecs.Entity {
|
||||
@@ -24,6 +26,7 @@ export class Hero extends ecs.Entity {
|
||||
HeroModel!: HeroModelComp;
|
||||
// 视图层
|
||||
HeroView!: HeroViewComp;
|
||||
|
||||
|
||||
protected init() {
|
||||
this.addComponents<ecs.Comp>( HeroModelComp);
|
||||
@@ -32,12 +35,12 @@ export class Hero extends ecs.Entity {
|
||||
|
||||
destroy(): void {
|
||||
this.remove(HeroViewComp);
|
||||
this.remove(MoveToComp);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!) {
|
||||
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!,index:number=-1) {
|
||||
var path = "game/hero/"+smc.heros[uuid].path;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
@@ -45,10 +48,33 @@ export class Hero extends ecs.Entity {
|
||||
// var as = node.getComponent(HeroSpine);
|
||||
// let ratio=this.set_ratio(uuid);
|
||||
// node.setScale(node.scale.x*scale*ratio, node.scale.y*ratio, 0);
|
||||
pos.x=smc.Role.RoleView.node.position.x+pos.x;
|
||||
pos.y=smc.Role.RoleView.node.position.y+pos.y;
|
||||
node.setPosition(pos)
|
||||
this.hero_init(uuid,node)
|
||||
this.hero_init(uuid,node,index)
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
}
|
||||
|
||||
hero_init(uuid:number=1001,node:Node,index:number=-1){
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
hv.speed =hv.ospeed = smc.heros[uuid].speed;
|
||||
hv.hero_name= smc.heros[uuid].name;
|
||||
hv.hp= hv.hp_max = smc.heros[uuid].hp;
|
||||
hv.level = smc.heros[uuid].level;
|
||||
hv.atk = smc.heros[uuid].atk;
|
||||
hv.atk_cd = smc.heros[uuid].atk_cd;
|
||||
hv.atk_dis = smc.heros[uuid].atk_dis;
|
||||
hv.power = smc.heros[uuid].power;
|
||||
hv.power_max= smc.heros[uuid].power_max;
|
||||
hv.type = smc.heros[uuid].type;
|
||||
hv.skill_uuid = smc.heros[uuid].skill_uuid;
|
||||
hv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
|
||||
hv.scale = 1;
|
||||
hv.role_heros_index = index;
|
||||
hv.Tpos = v3(0,0,0);
|
||||
this.add(hv);
|
||||
}
|
||||
set_ratio(uuid:number){
|
||||
let ratio=1;
|
||||
switch (smc.heros[uuid].level) {
|
||||
@@ -69,23 +95,4 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
return ratio;
|
||||
}
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var mv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
mv.speed =mv.ospeed = smc.heros[uuid].speed;
|
||||
mv.hero_name= smc.heros[uuid].name;
|
||||
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.atk_dis = smc.heros[uuid].atk_dis;
|
||||
mv.power = smc.heros[uuid].power;
|
||||
mv.power_max= smc.heros[uuid].power_max;
|
||||
mv.type = smc.heros[uuid].type;
|
||||
mv.skill_uuid = smc.heros[uuid].skill_uuid;
|
||||
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
|
||||
mv.scale = 1;
|
||||
mv.Tpos = v3(0,0,0);
|
||||
this.add(mv);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user