添加英雄
This commit is contained in:
@@ -181,6 +181,7 @@ export class BuffComp extends Component {
|
||||
hp_show(){
|
||||
let hp_progress= this.heroView.hp/this.heroView.rhp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.heroView.is_boss) return
|
||||
if(this.heroView.hp == this.heroView.rhp_max){
|
||||
this.node.getChildByName("top").getChildByName("hp").active = false;
|
||||
} else{
|
||||
|
||||
@@ -55,6 +55,7 @@ export class HeroViewComp extends CCComp {
|
||||
is_dead:boolean = false; //是否摧毁
|
||||
is_stop:boolean = false;
|
||||
is_atking:boolean = false;
|
||||
is_boss:boolean = false;
|
||||
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
@@ -137,6 +138,10 @@ export class HeroViewComp extends CCComp {
|
||||
/** 方向 */
|
||||
this.node.setScale(this.scale,1);
|
||||
this.node.getChildByName("top").setScale(this.scale,1);
|
||||
if(this.is_boss){
|
||||
this.node.setScale(this.node.scale.x*1.2,this.node.scale.y*1.2);
|
||||
this.node.getChildByName("top").getChildByName("sboss").active = true;
|
||||
}
|
||||
/** 显示角色血量 */
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
|
||||
@@ -509,8 +514,8 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
//使用max_skill
|
||||
do_skill(skill:number){
|
||||
this.as.max()
|
||||
this.at = 0; //共享普攻攻击cd
|
||||
// this.as.max()
|
||||
// this.at = 0; //共享普攻攻击cd
|
||||
this.BUFFCOMP.tooltip(3,SkillSet[skill].name,skill);
|
||||
switch (SkillSet[skill].tg) {
|
||||
case SkTG.self: //自己
|
||||
|
||||
@@ -41,7 +41,7 @@ export class Monster extends ecs.Entity {
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,is_hero:boolean=true) {
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,is_boss:boolean=false) {
|
||||
scale=-1
|
||||
let box_group=BoxSet.MONSTER
|
||||
console.log("mon load",uuid)
|
||||
@@ -49,22 +49,22 @@ export class Monster extends ecs.Entity {
|
||||
var path = "game/heros/"+HeroInfo[uuid].path;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!
|
||||
|
||||
node.setPosition(pos)
|
||||
this.hero_init(uuid,node,scale,box_group)
|
||||
this.hero_init(uuid,node,scale,box_group,is_boss)
|
||||
oops.message.dispatchEvent("monster_load",this)
|
||||
}
|
||||
|
||||
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO){
|
||||
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO,is_boss:boolean=false) {
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
let talent= smc.vmdata.talent //角色英雄数据
|
||||
let talents=Talents;
|
||||
hv.scale = scale;
|
||||
hv.is_boss = is_boss;
|
||||
hv.box_group = box_group;
|
||||
hv.hero_uuid= uuid;
|
||||
hv.hero_name= hero.name;
|
||||
|
||||
Reference in New Issue
Block a user