ThrowablePickup
An abstract class in Root.Township, the global namespace.
Base for pickups that act on themselves in flight after being thrown, such as turning to face their direction of travel. Subclasses implement ThrowBehaviour, which runs each physics step until the pickup hits something, is grabbed or is docked.
- Listed in Global namespace: T to X
- Inherits or implements
MonoBehaviour - Derived types
ThrowAlignHelper - Attributes
RequireComponent - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
protected ThrowablePickup() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
protected Pickup pickup | The pickup on this object. |
4 private and internal fields
Methods
7 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Hooks release, grab and dock events and starts disabled. |
private void CheckStart(Interactable interactable, Interactor interactor) | Enables the flight behaviour once nobody is holding the pickup. |
private void DockedEndAlign(Interactor interactor, Pickup pickup, PickupDock dock) | Stops the flight behaviour when the pickup is docked. |
private void FixedUpdate() | Advances the lerp time and calls ThrowBehaviour with the velocity and curve weight while moving fast enough. |
private void InteractEndAlign(Interactable interactable, Interactor interactor) | Stops the flight behaviour when the pickup is grabbed. |
private void OnCollisionEnter(Collision collision) | Stops the flight behaviour on any collision. |
private void OnEnable() | Resets the values when the flight starts. |