|
|
@@ -28,6 +28,14 @@ export default class Monster extends FightModel implements IPool {
|
|
|
|
|
|
@property(ProgressBar)
|
|
|
bar_boss: ProgressBar = null;
|
|
|
+ @property(ProgressBar)
|
|
|
+ bar_general: ProgressBar = null;
|
|
|
+ @property(cc.Label)
|
|
|
+ lbl_hp: cc.Label = null;
|
|
|
+ @property(cc.Label)
|
|
|
+ lbl_name: cc.Label = null;
|
|
|
+ @property(cc.Sprite)
|
|
|
+ img_belong: cc.Sprite = null;
|
|
|
|
|
|
@property(sp.Skeleton)
|
|
|
bing_die: sp.Skeleton = null;
|
|
|
@@ -68,7 +76,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
isPause: boolean;
|
|
|
|
|
|
/** 错位 */
|
|
|
- dis:number;
|
|
|
+ dis: number;
|
|
|
|
|
|
|
|
|
getAttachNodeCrood() {
|
|
|
@@ -94,14 +102,33 @@ export default class Monster extends FightModel implements IPool {
|
|
|
this.node.x = this.moveCroods[0];
|
|
|
this.node.y = this.moveCroods[1];
|
|
|
this.isdead = false;
|
|
|
+ let src;
|
|
|
if (v.type == 1) {
|
|
|
this.hpbar = this.bar_monster;
|
|
|
this.scaleRate = 0.57;
|
|
|
this.img_select.node.y = 120;
|
|
|
this.node_click.height = 140;
|
|
|
+ src = "module/fight/spine/" + v.resource;
|
|
|
}
|
|
|
else {
|
|
|
- this.hpbar = this.bar_boss;
|
|
|
+ if (typeof v.resource == 'number') {
|
|
|
+ this.hpbar = this.bar_general;
|
|
|
+ let vo = GameController.gameData.getGeneralByID(v.resource);
|
|
|
+ if (vo) {
|
|
|
+ src = vo.resource;
|
|
|
+ this.img_belong.node.active = true;
|
|
|
+ this.img_belong.spriteFrame = cc.loader.getRes("module/fight/prefab_texture/belong_" + vo.camp, cc.SpriteFrame);
|
|
|
+ this.lbl_name.string = vo.name;
|
|
|
+ src = "spine/person/" + vo.resource;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ console.log("怪物resrouce错误:", v.resource);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.hpbar = this.bar_boss;
|
|
|
+ src = "module/fight/spine/" + v.resource;
|
|
|
+ }
|
|
|
this.scaleRate = 0.9;
|
|
|
this.img_select.node.y = 180;
|
|
|
this.node_click.height = 200;
|
|
|
@@ -110,7 +137,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
this.node_click.y = this.node_click.height / 2;
|
|
|
|
|
|
this.lbl_id.string = v.id + "";
|
|
|
- this.skeleton.skeletonData = cc.loader.getRes("module/fight/spine/" + v.resource , sp.SkeletonData);
|
|
|
+ this.skeleton.skeletonData = cc.loader.getRes(src, sp.SkeletonData);
|
|
|
|
|
|
this.hpbar.init(v.hp, v.maxhp);
|
|
|
this.skeleton.node.scaleX = -1 * this.scaleRate;
|
|
|
@@ -151,7 +178,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
type = DAMAGE_TYPE.FATAL;
|
|
|
}
|
|
|
|
|
|
- this.popHpTips(hitstr, type,damage.isskill);
|
|
|
+ this.popHpTips(hitstr, type, damage.isskill);
|
|
|
|
|
|
if (isHit && damage.debuff) {
|
|
|
let debuff = GameController.gameData.getBuffByID(damage.debuff);
|
|
|
@@ -232,7 +259,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
* @param type
|
|
|
* @returns
|
|
|
*/
|
|
|
- private popHpTips(str, type: DAMAGE_TYPE,isskill:boolean=false) {
|
|
|
+ private popHpTips(str, type: DAMAGE_TYPE, isskill: boolean = false) {
|
|
|
if (!this.node || !this.vo) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -242,7 +269,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
let script = node_hp.getComponent(HpTips) as HpTips;
|
|
|
let lbl: cc.Label = node_hp.getChildByName("lbl_hptips").getComponent(cc.Label);
|
|
|
lbl.string = str;
|
|
|
- script.play(type, this.vo.type,isskill);
|
|
|
+ script.play(type, this.vo.type, isskill);
|
|
|
node_hp.parent = this.node;
|
|
|
node_hp.zIndex = 0;
|
|
|
}
|
|
|
@@ -309,7 +336,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
let b = this.dis == null;
|
|
|
if (stopWall.type == 1) {//左侧
|
|
|
if (this.node.y - 20 <= stopWall.y) {
|
|
|
- if(b){
|
|
|
+ if (b) {
|
|
|
this.dis = (Math.random() * 60 - 30);
|
|
|
this.node.x += this.dis;
|
|
|
}
|
|
|
@@ -318,7 +345,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
}
|
|
|
else if (stopWall.type == 2) {//下面
|
|
|
if (this.node.x + 100 >= stopWall.x) {
|
|
|
- if(b){
|
|
|
+ if (b) {
|
|
|
this.dis = (Math.random() * 60 - 30);
|
|
|
this.node.y += this.dis;
|
|
|
}
|
|
|
@@ -327,7 +354,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
}
|
|
|
else {//右侧
|
|
|
if (this.node.y + 50 >= stopWall.y) {
|
|
|
- if(b){
|
|
|
+ if (b) {
|
|
|
this.dis = (Math.random() * 60 - 30);
|
|
|
this.node.x += this.dis;
|
|
|
}
|
|
|
@@ -335,7 +362,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
this.dis = null;
|
|
|
}
|
|
|
let srcV = cc.v2(this.node.x, this.node.y);
|
|
|
@@ -381,6 +408,7 @@ export default class Monster extends FightModel implements IPool {
|
|
|
this.bing_die.node.active = false;
|
|
|
this.bar_monster.node.active = false;
|
|
|
this.bar_boss.node.active = false;
|
|
|
+ this.bar_general.node.active = false;
|
|
|
this.img_stop.node.active = false;
|
|
|
this.knife_light.removeAllChildren();
|
|
|
|