Skip to main content

ImpactSystemHitManager

A class in Root.Township, the global namespace.

Debug tool (console module impacts, needs debug_features) meant to send every server-side tool hit to subscribed clients as damage popups.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private static ImpactSystemHitManager instanceBacking field for Instance.
private static Logger loggerNLog logger for this class.
private List<IPlayer> subscribedPlayersServer: players who asked for hit updates.
private MethodSyncStruct<bool> subscribeMessageMethod sync for subscribe requests from clients.
private MethodSyncStruct<SerializedImpactHit> syncHitMethod sync that sends hits to players.

Properties​

MemberWhat it is
static ImpactSystemHitManager Instance { get; }The scene's instance, set in Awake.

Methods​

MemberWhat it is
override void Initialize()Creates the method syncs and, on the server, hooks player removal.
static void SubscribeToServerHits(bool isSubscribing)Console command impacts sync: asks the server to start or stop sending this player its hits.
8 private and internal methods
MemberWhat it is
private void Awake()Sets the static instance.
private void ChangeSubscriptionState(bool isSubscribing)Hooks or unhooks ImpactTool.OnHitAny on the server.
private void HandleImpactHit(ImpactHitWithTool hit, ImpactTool tool)Server: sends a hit to every subscribed player, dropping any that fail.
private void HandlePlayerLeft(Player player)Server: removes a leaving player from the subscribers.
private void HandlePlayerSubscribe(IPlayer player, Stream stream, bool state)Server: adds or removes a subscriber. It only adds a player who is already in the list, so subscribing probably never works.
private void HandlePlayerSubscribe(IPlayer player, bool state)Server: adds or removes a subscriber. It only adds a player who is already in the list, so subscribing probably never works.
private void HandleReceivedImpactHit(SerializedImpactHit hit)Client: shows a red damage popup at the hit position.
private void SyncImpactHit(IPlayer player, Stream stream, SerializedImpactHit hit)Sends a serialized hit. Client: shows it when received.