ActionOrb
A class in Root.Township, the global namespace.
A hovering orb the player grabs and pulls to their face to trigger an action, with haptics and a screen fade as it gets closer. Used for menu, revive and server selection orbs.
- Listed in Global namespace: A to B
- Inherits or implements
HoverPickup
Constructors
| Member | What it is |
|---|---|
ActionOrb() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
13 private and internal fields
| Member | What it is |
|---|---|
private bool canTriggerHaptic | Whether haptics play; set with SetCanReceiveHapticFeedback. |
private PlayerController controller | Player controller of whoever last grabbed the orb. |
private bool hasScreenFade | Whether bringing the orb to the head fades the screen. |
private const string IsMovingKeyword | Shader keyword turned on while the orb is moving back. |
private float minFadeToCountDownTime | Fade amount above which the force-join countdown runs. |
private Renderer[] renderersToChange | Renderers whose material SetMaterial replaces. |
private MaterialInstanceGroup squishableMaterialGroup | Material instances on the squishable renderers, made on awake and disposed on destroy. |
private Renderer[] squishableRenderers | Renderers that squish in the direction the orb moves. |
private const string SquishDirectionPropertyName | Shader property name for the squish direction. |
private static readonly int squishDirectionShaderId | Shader ID of the squish direction property. |
private bool startAtZeroScale | Starts the orb at zero scale so it can grow in. |
private float timeToForceJoin | Seconds the orb must be held close to the head before it lets go by itself. |
private Coroutine updateSelectionOrb | The running UpdateSelectionOrb coroutine, if any. |
Events
| Member | What it is |
|---|---|
event Action OnValidLetGo | Raised when the orb is released near the head, or held there long enough to force it. |
Methods
| Member | What it is |
|---|---|
void ResetVelocity() | Clears the squish effect. |
void SetCanReceiveHapticFeedback(bool canReceiveHaptic) | Turns the distance-based controller vibration on or off. |
void SetMaterial(Material material) | Sets the shared material on the orb's swappable renderers. |
protected override void Awake() | Creates material instances for the squish effect. |
protected override void HandleGrabbed(Interactable interactable, Interactor interactor) | Remembers the grabbing player and starts tracking the orb's distance to their head. |
protected override void OnDestroy() | Disposes the squish material instances. |
protected override void OnReturning(Vector3 direction, float velocity) | Client: drives the squish shader by the direction and speed the orb flies back. |
protected override void Start() | Starts the orb at zero scale if set to. |
protected override void StartMovingBack(Interactable interactable, Interactor interactor) | On release, raises OnValidLetGo if it was let go close enough to the head, else clears the fade. |
3 private and internal methods
Used in
Members of other types that take, return or hold a ActionOrb: