BattleUnitWorldBar

World-space хром юнита — сегментированное HP, AP-pip’ы, tint союзник/враг, опциональная угроза predamage, tooltip identity.
Пакет
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-pip'ы (≤8) |
Ally | Оформление союзник/враг |
BarActive | Неактивен / затемнён |
Predamage* | Оверлей угрозы на HP |
EntityId | Id моста host/ECS |
Init / ResolveDamage / SpendAction | Боевые хелперы |
ShowPredamage / ResetHealthVisual | Угроза + сброс визуала |
Заметки
DisplayNameиHpText— производные, привязывайте исходные пропы выше, а не эти два.- Один сегмент HP на очко ранения (не растянутая 10-сегментная полоса, когда
MaxHpотличается). - Для более простых world-меток предпочитайте kit SusHealthBar / SusUnitNameplate; эта полоса — тактический сегментированный вариант.