BattleUnitWorldBar

世界空间中的单位外框 — 分段 HP、AP 圆点、友军 / 敌军配色,可选预伤害威胁提示,工具提示身份信息。
包
SusGame · HUD(商业)
SusGame · HUD
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
UnitName | Prop<string> | "" | v-model |
Rank | Prop<string> | "" | v-model |
Description | Prop<string> | "" | v-model |
PositionLabel | Prop<string> | "" | v-model |
TipExtra | Prop<string> | "" | v-model |
CurrentHp | Prop<int> | 10 | v-model |
MaxHp | Prop<int> | 10 | v-model |
CurrentAp | Prop<int> | 2 | v-model |
MaxAp | Prop<int> | 2 | v-model |
PredamageMin | Prop<int> | 0 | v-model |
PredamageAccuracy | Prop<int> | 0 | v-model |
Predamage | Prop<bool> | false | v-model |
Ally | Prop<bool> | true | v-model |
BarActive | Prop<bool> | true | v-model |
EntityId | Prop<int> | -1 | v-model |
DisplayName | Prop<string> | "" | |
HpText | Prop<string> | "0" |
插槽
没有插槽。
事件
没有公开事件。
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
battle-unit-world-barbattle-unit-world-bar__ap-pipbattle-unit-world-bar__ap-pip--activebattle-unit-world-bar__ap-pip--hiddenbattle-unit-world-bar__ap-pip--spentbattle-unit-world-bar__ap-rowbattle-unit-world-bar__ap-spacerbattle-unit-world-bar__contentbattle-unit-world-bar__counterbattle-unit-world-bar__counter-labelbattle-unit-world-bar__hp-rowbattle-unit-world-bar__hp-segbattle-unit-world-bar__hp-seg--emptybattle-unit-world-bar__hp-seg--filledbattle-unit-world-bar__hp-seg--hiddenbattle-unit-world-bar__hp-seg--spentbattle-unit-world-bar__hp-seg--threatbattle-unit-world-bar__hp-seg-fillbattle-unit-world-bar__mainbattle-unit-world-bar__namebattle-unit-world-bar__rowbattle-unit-world-bar__statusesbattle-unit-world-bar__statuses--hiddenbattle-unit-world-bar__tipbattle-unit-world-bar--allybattle-unit-world-bar--enemybattle-unit-world-bar--inactivebattle-unit-world-bar--predamagesus-iconsus-status-effectsus-status-effect__icon
用法
csharp
var bar = new BattleUnitWorldBar();
bar.UnitName.Value = "Ranger";
bar.Rank.Value = "Sgt";
bar.Ally.Value = true;
bar.CurrentHp.Value = 7;
bar.MaxHp.Value = 10;
bar.CurrentAp.Value = 2;
bar.MaxAp.Value = 3;
bar.BarActive.Value = true;
bar.Init(wounds: 10, actionPoints: 3);
bar.ShowPredamage(minDamage: 2, accuracy: 75);xml
<template>
<sus:BattleUnitWorldBar :UnitName="Name.Value"
:Rank="Rank.Value"
:Description="Desc.Value"
:PositionLabel="Pos.Value"
:CurrentHp="Hp.Value"
:MaxHp="HpMax.Value"
:CurrentAp="Ap.Value"
:MaxAp="ApMax.Value"
:Ally="Ally.Value"
:BarActive="Active.Value"
:Predamage="Threat.Value"
:PredamageMin="ThreatMin.Value"
:PredamageAccuracy="ThreatAcc.Value"
:EntityId="Entity.Value" />
</template>
<script>
public Prop<string> Name = new("Ranger");
public Prop<string> Rank = new("Sgt");
public Prop<string> Desc = new("Scout · medium armor");
public Prop<string> Pos = new("A3");
public Prop<int> Hp = new(7);
public Prop<int> HpMax = new(10);
public Prop<int> Ap = new(2);
public Prop<int> ApMax = new(3);
public Prop<bool> Ally = new(true);
public Prop<bool> Active = new(true);
public Prop<bool> Threat = new(false);
public Prop<int> ThreatMin = new(0);
public Prop<int> ThreatAcc = new(0);
public Prop<int> Entity = new(-1);
</script>| Prop / API | 作用 |
|---|---|
UnitName · Rank · Description | 身份信息 / 提示框 |
PositionLabel · TipExtra | 额外的提示框文字行 |
CurrentHp / MaxHp | 伤口分段(1:1) |
CurrentAp / MaxAp | AP 圆点(≤8) |
Ally | 友军 / 敌军配色 |
BarActive | 未激活 / 变暗 |
Predamage* | HP 上的威胁覆盖层 |
EntityId | 宿主 / ECS 桥接 id |
Init / ResolveDamage / SpendAction | 战斗辅助方法 |
ShowPredamage / ResetHealthVisual | 威胁提示 + 视觉重置 |
备注
DisplayName和HpText是派生值 —— 请绑定上面列出的源属性,而不是这两个。- 每个伤口点对应一段 HP(当
MaxHp不同时,并非固定填充的 10 段条)。 - 对于更简单的世界空间标签,优先使用 kit 中的 SusHealthBar / SusUnitNameplate;本组件是战术分段变体。