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.
- Listed in Global namespace: S
- Inherits or implements
ProgressionSlotContainer
Constructors
| Member | What it is |
|---|---|
SkillOrbReplacer() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
12 private and internal fields
| Member | What it is |
|---|---|
private float acceleration | Acceleration used while the orb flies back to its target. |
private float distanceToSnapSquared | Squared distance to the shrine's operator at which the held orb snaps on and starts the purchase hold. |
private float distanceToUnSnapSquared | Squared distance from the hand grip point that breaks the snap and cancels the hold. |
private FauxRigidbody fauxRigidBody | Simulated rigidbody used for the fly-back, created on first use. |
private Coroutine heldDurationCheck | The running hold-check coroutine. |
private float holdDuration | Seconds the orb must stay snapped to the operator before the purchase is confirmed (3 by default). |
private bool isOperating | True while the orb is snapped to the shrine's operator and the hold timer runs. |
private float maxDistanceFromTargetSquared | Squared distance from its home position before it snaps; pulling it further away forces the player to drop it. |
private float moveSpeed | Top speed while the orb flies back to its target. |
private Coroutine returningToTargetCoroutine | The running fly-back coroutine, or null. |
private float rotationLerpSpeed | How fast the orb turns back to identity rotation while flying back. |
private SkillOrb targetOrb | The skill orb on the shrine this replacer stands in for. Set by InitializeOrb (clients get it from the setup sync). |
Properties
| Member | What it is |
|---|---|
protected override bool DestroyAfterOperate { get; } | True: the orb is destroyed once the skill is unlocked. |
Methods
| Member | What 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
| Member | What 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: