ShadyGuyTracker class
The tracker maintains three counters:total: All ShadyGuys spawned in the current roundinteracted: ShadyGuys the player successfully interacted withdisappeared: ShadyGuys that vanished before interaction
Tracking ShadyGuy spawns
The mod patches theStart method to count ShadyGuys as they spawn:
Implementation details
Start method hook
Start method hook
Unity’s
Start() is called when the ShadyGuy GameObject is activated, making it ideal for detecting new spawns before any player interaction.Round state check
Round state check
Like other trackers, this patch verifies tracking is enabled before incrementing the counter to prevent false counts in menus or between rounds.
Tracking interactions
When a player successfully interacts with a ShadyGuy, the counter is incremented:The
__result parameter contains the return value of the original Interact() method. The patch only counts interactions that returned true, meaning they were successful.Return value checking
Why check __result?
Why check __result?
The
Interact() method returns bool to indicate success. Checking __result ensures the counter only increments for valid interactions, not failed attempts or invalid states.Tracking disappearances
ShadyGuys can disappear if not interacted with in time:The disappearance counter helps players track missed opportunities. The patch also logs the rarity of the ShadyGuy that disappeared for debugging purposes.
Usage example
During a typical run:- First ShadyGuy spawns
total= 1,interacted= 0,disappeared= 0- Player interacts with it
total= 1,interacted= 1,disappeared= 0- Second ShadyGuy spawns
total= 2,interacted= 1,disappeared= 0- Second ShadyGuy disappears before interaction
total= 2,interacted= 1,disappeared= 1
ShadyGuys: 1/2