DamageDebugDisplay
A class in Root.Township, the global namespace.
Client debug text on the player that shows the last three attacks with their damage multipliers (distance, direction, weight). Toggled with Shift plus the FPS display action, for users with the debug_features permission.
- Listed in Global namespace: C to D
- Inherits or implements
MonoBehaviour - Nested types
DamageHolder - Attributes
RequireComponent
Constructors
| Member | What it is |
|---|---|
DamageDebugDisplay() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private float automaticCleanCooldown | Seconds of no new attacks before it clears itself; -1 turns that off. |
private const string baseText | Header line naming the columns. |
private bool btnClean | Inspector button that calls Clean. |
private static Dictionary<PlayerController, DamageDebugDisplay.DamageHolder> holderPairs | Stored attacks for each player. |
private PlayerController playerController | The player this display belongs to. |
private float targetClean | Time at which it will clear itself. |
private Text text | The UI Text drawn to. |
Methods
| Member | What it is |
|---|---|
static void AddAttack(PlayerController playerController, float damage, float followValue, float followMultiplier, float directionValue, float directionMultiplier, float weight, float weightPenaulty, ImpactType dmgType) | Records an attack's damage breakdown for a player, keeping the last three. Called from damage code. |
6 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Gets the text and player controller and sets the header line. |
private void Clean() | Clears the stored attacks and resets the text to the header. |
private void Clean(DamageDebugDisplay.DamageHolder holder) | Clears the stored attacks and resets the text to the header. |
private void Start() | Hooks the left controller's DisplayFPS action and starts hidden. |
private void ToggleFPSDisplay(PlayerInput controller) | Shows or hides the display when Shift is held and the user has debug_features. |
private void Update() | Refreshes the text when new attacks arrive, and clears it after automaticCleanCooldown if that is above 0. |