Skip to main content

DamageDisplayer

A class in Root.Township, the global namespace.

Debug total of damage the local player has dealt recently. Each Player has one (Player.DamageDisplayer); the server sends hits to the hitting player's client.

Constructors​

MemberWhat it is
DamageDisplayer(Player player)Creates a DamageDisplayer from player.

Fields​

4 private and internal fields
MemberWhat it is
private Player playerThe player this displayer belongs to.
private MethodSyncStruct<float> syncDamageMethod sync used to send damage to the player. Not created for the server's own local player.
private float targetTimeReal time when TotalDamage resets.
private IUnityUpdateMethod updateTimerHandle for the registered UpdateTimer method.

Properties​

MemberWhat it is
static float TotalDamage { get; private set; }Damage the local player dealt in the current burst. Resets to zero 5 seconds after the last hit. Shown by debug displays.

Methods​

MemberWhat it is
void DealtDamage(float damage)On the local player, adds to TotalDamage and restarts the 5 second reset; otherwise sends the damage to that player.
3 private and internal methods
MemberWhat it is
private void Clear(NetworkEntity entity, bool isUnload)Stops the reset timer when the player is destroyed by the scene.
private void SyncDamage(IPlayer player, Stream stream, float damage)Method sync that carries one damage amount to the player and adds it on arrival.
private void UpdateTimer()Budgeted update that resets TotalDamage once the 5 seconds have passed.

Used in​

Members of other types that take, return or hold a DamageDisplayer: