BoughtSkillVisualizer
A class in Root.Township, the global namespace.
The ring of orb holders on a skill shrine that shows the skills a player has bought, one orb per bought slot. The server spawns the orbs; clients get them through Serialize.
- Listed in Global namespace: A to B
- Inherits or implements
SkillShrineVisualizer,IBuildRendererPostBake,IBuildBakeable - Nested types
OrbHolderHandle,PositionMachine
Constructors
| Member | What it is |
|---|---|
BoughtSkillVisualizer() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
18 private and internal fields
| Member | What it is |
|---|---|
private static readonly int _FillProgress | Shader property id for _FillProgress. |
private static readonly int _NegativeChangeProgress | Shader property id for _NegativeChangeProgress. |
private static readonly int _PositiveChangeProgress | Shader property id for _PositiveChangeProgress. |
private Rigidbody anchorBody | Backing field for AnchorBody. |
private int crystalCount | Number of orb holders, normally ProgressionSettings.MaxBoughtSkills. |
private ProgressionShrine fillVisualizerObject | The progression shrine whose path visualizers the orbs reposition to. |
private SkillOrbHolder holderPrefab | SkillOrbHolder prefab placed round the ring. |
private float lastLockedEffect | Time the locked effect last played, for the cooldown. |
private TransformEvent lockedByDependencyEffect | Effect played on orbs locked by an unmet dependency. |
private float lockedEffectCooldown | Minimum seconds between locked effects. |
private PlayerProgressionManager manager | The progression manager passed to PrepareOnServer. |
private int nextFreeHolder | Index of the holder the next spawned orb goes into. |
private Quaternion offsetRotation | Extra rotation applied to each placed holder. |
private NetworkPrefab orbPrefab | Prefab spawned for each bought skill orb. |
private BoughtSkillVisualizer.OrbHolderHandle[] placedHolders | The orb holder handles, one per crystal. |
private float radius | Radius of the holder ring. |
private bool showFreePointsAvailable | Whether free skill points show as open holders. Set by SetPath. |
private float verticalOffset | Vertical offset of holders from the ring positions. |
Properties
| Member | What it is |
|---|---|
Rigidbody AnchorBody { get; } | Rigidbody the bought skill orbs are anchored to. |
Methods
| Member | What it is |
|---|---|
void CallLockedByDependencyEffect(ProgressionSlot slot) | Plays the locked effect on every orb whose skill depends on the given slot, at most once per lockedEffectCooldown. |
override void Disable() | Clears every orb holder and resets the next free holder. The server destroys the orb entities. |
bool IsBeingInteracted() | True if a player is holding any of the placed orbs. |
override void PrepareOnServer(PlayerProgressionManager manager) | Server: stores the progression manager, syncs orbs to the player's bought slots and updates holder open states. |
override void Serialize(Stream stream, PlayerProgressionManager manager) | Syncs free points and which holder has which orb entity; clients wait for the orb to spawn and attach it. |
override void SetPath(ProgressionPath path) | Sets the progression path and turns on showing free points as open holders. |
8 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Sets crystalCount from ProgressionSettings.MaxBoughtSkills if unset and places holders if none were baked. |
private void GetNextFree() | Moves nextFreeHolder to the next holder with no orb, wrapping round. |
private int GetOrbIndex(ProgressionSlot slot) | Returns the holder index that holds the given slot, or -1. |
private void OnDrawGizmosSelected() | Editor: draws the orb mesh at each holder position. |
private void PlaceOrbHolders() | Destroys old holders and spawns crystalCount holders in a circle of radius around the transform. |
private void IBuildRendererPostBake.PostBake() | Build step: recounts crystals from settings and places the holders. |
private void UpdateHolders(int freePoints) | Client: opens empty holders for each free point and closes the rest, or locks ones with unmet dependencies. |
private void UpdateOrbsOnServer(PlayerProgressionManager manager) | Server: spawns an orb for each new bought slot, updates dependency locks on existing ones and clears holders no longer used. |
Used in
Members of other types that take, return or hold a BoughtSkillVisualizer: