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.
- Listed in Global namespace: I to L
- Inherits or implements
NetworkEntityBehaviour - Attributes
WithPermissionOnly,Module - Documented in Impacts and hit detection, Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
ImpactSystemHitManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private static ImpactSystemHitManager instance | Backing field for Instance. |
private static Logger logger | NLog logger for this class. |
private List<IPlayer> subscribedPlayers | Server: players who asked for hit updates. |
private MethodSyncStruct<bool> subscribeMessage | Method sync for subscribe requests from clients. |
private MethodSyncStruct<SerializedImpactHit> syncHit | Method sync that sends hits to players. |
Properties
| Member | What it is |
|---|---|
static ImpactSystemHitManager Instance { get; } | The scene's instance, set in Awake. |
Methods
8 private and internal methods
| Member | What 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. |