Skip to main content

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.

Constructors​

MemberWhat it is
DamageDebugDisplay()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

7 private and internal fields
MemberWhat it is
private float automaticCleanCooldownSeconds of no new attacks before it clears itself; -1 turns that off.
private const string baseTextHeader line naming the columns.
private bool btnCleanInspector button that calls Clean.
private static Dictionary<PlayerController, DamageDebugDisplay.DamageHolder> holderPairsStored attacks for each player.
private PlayerController playerControllerThe player this display belongs to.
private float targetCleanTime at which it will clear itself.
private Text textThe UI Text drawn to.

Methods​

MemberWhat 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
MemberWhat 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.