feat(英雄系统): 添加怒气值属性及相关功能
top 血条样式调整 - 在HeroAttrsComp中添加pow属性表示当前怒气值 - 在HeroAttrs枚举中添加POW_MAX和POW_REGEN属性 - 修改HeroViewComp根据英雄类型显示不同资源条 - 调整boss血条位置偏移量 - 注释掉物理系统调试绘制代码
This commit is contained in:
@@ -12,6 +12,7 @@ import { Attrs, } from "../common/config/HeroAttrs";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { Tooltip } from "../skill/Tooltip";
|
||||
import { timedCom } from "../skill/timedCom";
|
||||
import { HeroInfo, HType } from "../common/config/heroSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -28,6 +29,8 @@ export class HeroViewComp extends CCComp {
|
||||
status:String = "idle"
|
||||
scale: number = 1; // 显示方向
|
||||
box_group:number = BoxSet.HERO; // 碰撞组
|
||||
usePower:boolean = false;
|
||||
useMp:boolean = false;
|
||||
// ==================== UI 节点引用 ====================
|
||||
private top_node: Node = null!;
|
||||
|
||||
@@ -66,11 +69,14 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.setScale(this.scale,1);
|
||||
this.top_node.setScale(this.scale,1);
|
||||
if(this.model && this.model.is_boss){
|
||||
this.top_node.position=v3(this.node.position.x,this.node.position.y+100,0)
|
||||
this.top_node.position=v3(this.node.position.x,this.node.position.y+70,0)
|
||||
}
|
||||
/* 显示角色血*/
|
||||
this.top_node.getChildByName("hp").active = true;
|
||||
this.top_node.getChildByName("pow").active = true;
|
||||
this.usePower=HeroInfo[this.model.hero_uuid].type==HType.warrior||HeroInfo[this.model.hero_uuid].type==HType.assassin;
|
||||
this.useMp=HeroInfo[this.model.hero_uuid].type==HType.mage||HeroInfo[this.model.hero_uuid].type==HType.remote||HeroInfo[this.model.hero_uuid].type==HType.support;
|
||||
this.top_node.getChildByName("pow").active = this.usePower;
|
||||
this.top_node.getChildByName("mp").active = this.useMp;
|
||||
}
|
||||
|
||||
/** 初始化 UI 节点引用 */
|
||||
@@ -98,7 +104,8 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
// ✅ 更新 UI 显示(数据由 HeroAttrSystem 更新)
|
||||
this.hp_show(this.model.hp, this.model.Attrs[Attrs.HP_MAX]);
|
||||
this.mp_show(this.model.mp, this.model.Attrs[Attrs.MP_MAX]);
|
||||
if(this.useMp) this.mp_show(this.model.mp, this.model.Attrs[Attrs.MP_MAX]);
|
||||
if(this.usePower) this.pow_show(this.model.pow, this.model.Attrs[Attrs.POW_MAX]);
|
||||
this.show_shield(this.model.shield, this.model.Attrs[Attrs.SHIELD_MAX]);
|
||||
}
|
||||
|
||||
@@ -125,12 +132,17 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
/** 显示魔法值 */
|
||||
private mp_show(mp: number, mp_max: number) {
|
||||
this.top_node.getChildByName("pow").getComponent(ProgressBar).progress = mp / mp_max;
|
||||
this.top_node.getChildByName("mp").getComponent(ProgressBar).progress = mp / mp_max;
|
||||
this.scheduleOnce(() => {
|
||||
this.top_node.getChildByName("pow").getChildByName("mpb").getComponent(ProgressBar).progress = mp / mp_max;
|
||||
this.top_node.getChildByName("mp").getChildByName("mpb").getComponent(ProgressBar).progress = mp / mp_max;
|
||||
}, 0.15);
|
||||
}
|
||||
private pow_show(pow: number, pow_max: number) {
|
||||
this.top_node.getChildByName("pow").getComponent(ProgressBar).progress = pow / pow_max;
|
||||
this.scheduleOnce(() => {
|
||||
this.top_node.getChildByName("pow").getChildByName("mpb").getComponent(ProgressBar).progress = pow / pow_max;
|
||||
}, 0.15);
|
||||
}
|
||||
|
||||
/** 升级特效 */
|
||||
private lv_up() {
|
||||
var path = "game/skill/buff/buff_lvup";
|
||||
|
||||
Reference in New Issue
Block a user