Skip to main content

SkillOrbReplacer

A class in Root.Township, the global namespace.

The orb a player pulls from a skill shrine to buy a skill. Holding it at the shrine's operator for a few seconds unlocks the slot; letting go floats it back and destroys it.

Constructors​

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

Fields​

12 private and internal fields
MemberWhat it is
private float accelerationAcceleration used while the orb flies back to its target.
private float distanceToSnapSquaredSquared distance to the shrine's operator at which the held orb snaps on and starts the purchase hold.
private float distanceToUnSnapSquaredSquared distance from the hand grip point that breaks the snap and cancels the hold.
private FauxRigidbody fauxRigidBodySimulated rigidbody used for the fly-back, created on first use.
private Coroutine heldDurationCheckThe running hold-check coroutine.
private float holdDurationSeconds the orb must stay snapped to the operator before the purchase is confirmed (3 by default).
private bool isOperatingTrue while the orb is snapped to the shrine's operator and the hold timer runs.
private float maxDistanceFromTargetSquaredSquared distance from its home position before it snaps; pulling it further away forces the player to drop it.
private float moveSpeedTop speed while the orb flies back to its target.
private Coroutine returningToTargetCoroutineThe running fly-back coroutine, or null.
private float rotationLerpSpeedHow fast the orb turns back to identity rotation while flying back.
private SkillOrb targetOrbThe skill orb on the shrine this replacer stands in for. Set by InitializeOrb (clients get it from the setup sync).

Properties​

MemberWhat it is
protected override bool DestroyAfterOperate { get; }True: the orb is destroyed once the skill is unlocked.

Methods​

MemberWhat it is
override void Initialize()On clients, plays the orb destroy effect when it is destroyed other than by unloading.
void InitializeOrb(SkillOrb orb)Links to the shrine's skill orb and takes its slot and player.
void StopOperating()Ends the operating effect and state.
protected override void EndInteraction(Interactable arg1, Interactor arg2)On release, breaks any operator joint without buying and floats the orb back to its spot.
protected override IEnumerator HeldDurationCheck(Interactor interactor) (iterator)Coroutine while held: snaps to the operator when close, fills the progress, and confirms the buy after the hold time.
protected override void Operate(PlayerProgressionManager targetManager)Unlocks the slot on the player's progression manager.
protected override void StartInteraction(Interactable interactable, Interactor interactor)Stops the float back when grabbed again.
protected override void SyncSetup(IPlayer player, Stream stream)Sends the linked skill orb's entity ID so clients can link to it.
2 private and internal methods
MemberWhat it is
private IEnumerator ReturnSelectionOrb() (iterator)Coroutine run when the player lets go: flies the orb back to its target position with a faux rigidbody, then scene-destroys it.
private void SceneDestroy(NetworkEntity entity, bool isUnload)Client: plays the orb destroy effect when the entity is destroyed, unless it is unloading or flying back.

Used in​

Members of other types that take, return or hold a SkillOrbReplacer: