Skip to main content

DmgTDisplay

A class in Root.Township, the global namespace.

Client debug text that shows total damage dealt (DamageDisplayer.TotalDamage), toggled with the FPS display action without Shift by users with debug_features. It also pings the server and requests server diagnostics while shown.

Constructors​

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

Fields​

15 private and internal fields
MemberWhat it is
private float bytesPerSecondUnused.
private NetworkEntity entityThe parent network entity.
private const string formatText format for the damage line.
private float gamePingLast game ping in seconds from PingMessage.
private float intervalSeconds between pings.
private float lastHitUnused.
private float messagesPerSecondUnused.
private float oldFullBytesUnused.
private float oldMessageCountUnused.
private float oldPacketCountUnused.
private float packetsPerSecondUnused.
private float pingLast measured connection ping.
private PlayerController playerControllerThe player this display is on.
private Text textThe UI Text drawn to.
private float updateTimeTime since the last ping.

Methods​

8 private and internal methods
MemberWhat it is
private void Awake()Gets the text, entity and player controller.
private void OnDisable()Tells the server to stop sending diagnostics.
private void OnEnable()Asks the server to send diagnostics.
private void Ping()Pings the first connection and stores the result.
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 not held and the user has debug_features.
private void Update()Each interval, pings and sends a ping message for the local player; every frame, updates the damage text.
private void UpdatePing(float ping)Stores the measured connection ping.