KeyItem
A class in Root.Township, Alta.Inventory.
A pickup that works as a key. While inside a lock it's held at the lock's position and facing, after the player's IK runs.
- Listed in Items, inventory and logic
- Inherits or implements
Pickup - Derived types
KeyItemEvent,KeyUnityEvent - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
KeyItem() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
2 private and internal fields
Properties
Methods
| Member | What it is |
|---|---|
override bool AssessScore(Interactor interactor, out float score) | Can't be grabbed while the component is disabled. |
override void FinishInteraction(Interactor interactor) | Lets go normally, but treats a key inside a lock as mid-interaction so it stays put. |
void SetColliders(bool enabled) | Moves the key's set colliders to the Default layer, or to Hand Triggers to turn their collisions off. |
protected override void OnDisable() | Stops following the holder's IK. |
protected override void OnDrawGizmosSelected() | Draws the key's tip in the editor. |
protected override void OnEnable() | Starts following the holder's IK when grabbed. |
3 private and internal methods
| Member | What it is |
|---|---|
private void DeRegisterIK(Interactable interactable, Interactor interactor) | Unhooks Reposition from the holding player's IK updates when the interaction ends. |
private void RegisterIK(Interactable interactable, Interactor interactor) | Hooks Reposition into the holding player's IK updates when a player starts holding the key. |
private void Reposition() | After IK runs, snaps the key to LockPosition facing LookAtLock while it's inside a lock. |
Used in
Members of other types that take, return or hold a KeyItem: