Class PinnedTargetRules
The rule that decides when a pinned target is released, as arithmetic on facts about it.
public static class PinnedTargetRules
- Inheritance
-
PinnedTargetRules
- Inherited Members
Remarks
A pin is a promise the frame makes to the player: "this card stays up until you let go". The only things that break the promise are the target ceasing to be something a card can describe — destroyed or despawned on this client, or dead — and the target leaving the distance inside which targeting means anything at all. Nothing else does: not the pointer moving, not a panel opening, not the pinned character walking behind a wall.
Static and free of Unity types so the truth table can be pinned by a plain unit test.
TargetController gathers the facts and asks; nothing else decides.
Fields
RELEASE_DISTANCE
Distance beyond which a pin is released, in metres.
public const float RELEASE_DISTANCE = 75
Field Value
Remarks
Deliberately wider than TargetController.MAX_TARGET_DISTANCE, the acquisition
range. A character pinned at the edge of acquisition range and drifting a step further
away would otherwise lose its card at once, and a target that is being chased is, by
definition, one that is trying to get away. The gap is the hysteresis.
Methods
ShouldRelease(bool, bool, bool, float, float)
Decides whether a pinned target must be released.
public static bool ShouldRelease(bool isDestroyed, bool isSpawned, bool isAlive, float sqrDistance, float releaseDistance)
Parameters
isDestroyedboolTrue when the target's transform no longer exists on this client.
isSpawnedboolTrue when the target's network object is still spawned on this client.
isAliveboolTrue when the target is alive, or has no health to lose.
sqrDistancefloatSquared distance from the local player to the target, in metres squared.
releaseDistancefloatThe release distance, in metres; zero or less means no distance limit.
Returns
- bool
True when the pin must be released.