[IDEA] Add custom fields to Footprint
Goal Description
Perhaps we can add a string field to store data. It's very troublesome to ask Footprint to save other states, such as asking FlashbangGrenade to determine the player's health when thrown.
Notes
However, it may affect performance
You can create a ConditionalWeakTable and use the footprint's Stopwatch field as a key. This lets you attach your own classes to the footprint while letting the stopwatch be collected by the GC.
You can create a
ConditionalWeakTableand use the footprint'sStopwatchfield as a key. This lets you attach your own classes to the footprint while letting the stopwatch be collected by the GC.
This is a good idea, I'll give it a try Thank you.
@hatulaile You can also track footprints with a normal dictionary, as GetHashCode() returns its serial.
你也可以用普通字典追踪足迹,因为它会返回序列号。
GetHashCode()
It's indeed possible, but at the end of the game, you still need to clean up the regular dictionary