A class in Root.Township, the global namespace.
Stand-in interactable that takes over a pickup's grips while that pickup is locked in place. DiggingImpactor uses it while a shovel is stuck in the ground.
Constructors
| Member | What it is |
|---|
FakePickup() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private Rigidbody cachedRigidbody | This object's rigidbody, which hand joints connect to. |
private FixedJoint fixedJoint | Joint holding the target pickup to this object while attached. |
private Dictionary<Interactor, GrabPointParameters> interactorToGrabPoint | Grab point each hand used, so it can be restored on the real pickup when detaching. |
private static Logger logger | NLog logger for this class. |
private Pickup targetPickup | The real pickup this object stands in for. |
Properties
| Member | What it is |
|---|
Dictionary<Interactor, Joint> Joints { get; } | Fixed joints from each hand holding this object. |
Events
| Member | What it is |
|---|
event Action<Interactor> FakeInteractionEnded | Raised when a hand lets go of the fake pickup. |
event Action<Interactor> FakeInteractionStarted | Raised when a hand grabs the fake pickup. |
Methods
| Member | What it is |
|---|
void Attach() | Moves the target pickup's hands onto this object, freezes the pickup and joins it here with a fixed joint. |
void Dettach() | Undoes Attach: hands the grips back to the target pickup, unfreezes it and removes the fixed joint. |
override void FinishInteraction(Interactor interactor) | Stops the grip animation, removes the hand's joint and fires FakeInteractionEnded. |
override void Interact(Interactor interactor) | Grabs as if grabbing the target pickup (same grab point and hand placement), then joins the hand here. |
void SetTargetPickup(Pickup pickup) | Sets the pickup this object stands in for, removing itself from the old pickup's forward list. |
3 private and internal methods
| Member | What it is |
|---|
private void CreateJoint(Interactor interactor) | Adds a fixed joint from the hand's interaction point to this object and stores the grab offsets on the hand. |
private void DestroyJoint(Interactor interactor) | Removes the hand's joint, deferring the destroy during a physics overlap. |
private bool EditorSetup() | Editor helper: caches the rigidbody and disables the component. |
Used in
Members of other types that take, return or hold a FakePickup: