PlayerToolBasedSkillHelper
A class in Root.Township, the global namespace.
Player component that tracks the pickups a player holds and wires active pickup-based skills and their modifiers to them. Feeds tool hits and per-frame updates to each held pickup's handler.
- Listed in Global namespace: P
- Inherits or implements
PlayerComponent
Constructors
| Member | What it is |
|---|---|
PlayerToolBasedSkillHelper() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private Dictionary<PickupBasedSkill, HashSet<PickupBasedSkillModifier>> activeSkills | Registered pickup-based skills, each with its set of registered modifiers. |
private IUnityUpdateMethod update | Handle for the registered late-update, or null when not updating. |
private static UpdateModule updateModule | Shared late-update module all instances register with. |
Properties
| Member | What it is |
|---|---|
Dictionary<Interactable, HeldPickupHandler> HeldInteractables { get; } | Held pickups that passed at least one active skill, mapped to their handler. |
Methods
| Member | What it is |
|---|---|
ISkillInputMethod ActivateInput(IInputBasedSkill skill, HeldPickupHandler handler) | Registers a skill on a held pickup's input method, hooks its active-state change and returns the input method. |
void DeactivateOtherModifiers(PickupBasedSkillModifier modifierSkill, HeldPickupHandler handler) | Turns off every other modifier of the same skill on this held pickup, so only the given modifier stays active. |
void DeregisterSkill(PickupBasedSkill skill) | Removes a skill and unregisters it from every held pickup. |
void DeregisterSkillModifier(PickupBasedSkillModifier modifierSkill) | Removes a skill modifier and unhooks it from the matching input on every held pickup. |
void DeregisterUpdate(HeldPickupHandler handler) | Stops the per-frame update once no held pickup handler still needs updating. |
void RegisterSkill(PickupBasedSkill skill) | Adds a pickup-based skill and applies it to whatever the player already holds. |
void RegisterSkillModifier(PickupBasedSkillModifier modifierSkill) | Adds a modifier to its skill's set, if that skill is registered. |
void RegisterUpdate(HeldPickupHandler handler) | Starts the shared late-update that ticks every held pickup handler. |
8 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Subscribes to the player's interaction start and end events. |
private void InteractionEnded(Interactor interactor, Interactable interactable) | When the player lets go of a pickup (with no hand still on it), drops its handler and stops hit or update hooks if nothing is left. |
private void InteractionStarted(Interactor interactor, Interactable interactable) | When the player grabs a pickup, makes a handler for it and keeps it if any active skill accepts it. |
private void NewSkillOnInteractor(Interactor interactor) | Called for each hand when a skill is registered, so a pickup already in hand gets the new skill. |
private void OnDestroy() | Unsubscribes from the player's interaction events. |
private void ReceiveHit(ProgressionPath path, ImpactHitWithTool hitWithTool, Pickup hitPickup) | Passes a progression path hit made with a held tool to that tool's handler. |
private void UpdateHandlers() | Late-update tick: calls Update on every held pickup handler. |
private bool ValidatePickupHandler(HeldPickupHandler handler) | Checks each active skill against a held pickup; for each that accepts it, activates the input, hooks modifiers and registers the skill. |
Used in
Members of other types that take, return or hold a PlayerToolBasedSkillHelper: