PullPickup
A class in Root.Township, the global namespace.
A stand-in pickup that forwards grabs to a target item and hands it over when pulled far enough in a set direction. Used for buried items when digging. The server checks the pull.
- Listed in Global namespace: P
- Inherits or implements
NetworkEntityBehaviour - Derived types
PullEvent,PullEventHandler - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
PullPickup() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
10 private and internal fields
| Member | What it is |
|---|---|
private Transform cachedTransform | This object's transform, cached. |
private bool isReleasingTargetOnPull | If true, the target stays released after the pull instead of being forwarded again. |
private Coroutine pullCoroutine | Running CheckPull, or null. |
private Vector3 pullDirection | Local direction the hand must pull in. |
private float pullDistance | Backing field for PullDistance, at least 0.05. |
private PullEvent pulledOnClient | Event run on clients when pulled. |
private PullEvent pulledOnServer | Event run on the server when pulled. |
private MethodSyncStruct<bool> syncForward | Method sync for the forward state. |
private MethodSync syncPulled | Method sync for the pull. |
private Interactable targetPickup | The interactable pulled free (for example a cork or a sword in a stone). While null, this pickup is disabled. |
Properties
| Member | What it is |
|---|---|
Pickup Pickup { get; } | This entity's Pickup. |
float PullDistance { get; set; } | How far (local units) the hand has to move along the pull direction. Minimum 0.05. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Sets up forwarding to the target (or disables the pickup with no target) and the sync messages. |
void Pull(Interactor interactor = null) | Releases the target: swaps the interactor's grab to it, or with no interactor pops it up and makes it physical. Then fires the pulled events. |
void SetTargetPickup(Interactable targetPickup) | Sets the target if none is set yet and starts forwarding its grabs to this pickup. |
7 private and internal methods
| Member | What it is |
|---|---|
private IEnumerator CheckPull(Interactor interactor) (iterator) | Server coroutine: while the hand holds this pickup, pulls once the hand has moved pullDistance along pullDirection. |
private void HandleForward(bool isSettingForward) | Starts or stops forwarding grabs of the target to this pickup. With isReleasingTargetOnPull, the server also makes the target save on its own. |
private static void OffsetHandTargetForGrabAssist(Pickup pickup, Interactor interactor) | Offsets the hand target when grab assist picks it up from more than about 0.3 m away. |
private void OnDrawGizmosSelected() | Draws the pull direction and distance in the editor. |
private void StartCheck(Interactable interactable, Interactor interactor) | Server: starts CheckPull when someone grabs this pickup. |
private void SyncForward(IPlayer player, Stream stream, bool isSettingForward) | Syncs whether grabs are forwarded; the server relays it to the chunk. |
private void SyncPulled(IPlayer player, Stream stream) | Syncs a pull; the server relays it and runs its event, clients free the target and play the pull event. |
Used in
Members of other types that take, return or hold a PullPickup: