Skip to main content

ImmediateDecay

A class in Root.Township, the global namespace.

Destroys a pickup soon after it is let go, with a fade effect, unless it is picked up again or docked. Nothing in the code calls InitializeAsServer or sets Pickup, so it probably does nothing as is.

Constructors​

MemberWhat it is
ImmediateDecay()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private Coroutine decayThe running decay coroutine, if any.
private float decayDurationSeconds the decay effect plays before the entity is destroyed.
private EffectReleaseOnFade decayEffectThe decay effect playing now.
private PooledObjectDefinition decayEffectDefinitionPooled effect to play while decaying.
private float delayToStartDecayingSeconds after release before the decay effect starts.

Properties​

MemberWhat it is
Pickup Pickup { get; private set; }The pickup whose release starts the decay.

Methods​

6 private and internal methods
MemberWhat it is
private IEnumerator Decay() (iterator)Coroutine: if not docked, waits, plays the decay effect, waits again, then destroys the entity on the server.
private void InitializeAsServer()Hooks the decay start and stop to the pickup's release, grab and dock events.
private void OnDestroy()Releases the decay effect if one is playing.
private void StartDecay(Interactable interactable, Interactor interactor)Starts the decay coroutine when the pickup is released.
private void StopDecay(Interactable interactable, Interactor interactor)Stops the decay and its effect when the pickup is grabbed.
private void StopDecayDock(Interactor interactor, Pickup pickup, PickupDock dock)Stops the decay and its effect when the pickup is docked.