Skip to main content

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.

Constructors​

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

Fields​

18 private and internal fields
MemberWhat it is
private static readonly int _FillProgressShader property id for _FillProgress.
private static readonly int _NegativeChangeProgressShader property id for _NegativeChangeProgress.
private static readonly int _PositiveChangeProgressShader property id for _PositiveChangeProgress.
private Rigidbody anchorBodyBacking field for AnchorBody.
private int crystalCountNumber of orb holders, normally ProgressionSettings.MaxBoughtSkills.
private ProgressionShrine fillVisualizerObjectThe progression shrine whose path visualizers the orbs reposition to.
private SkillOrbHolder holderPrefabSkillOrbHolder prefab placed round the ring.
private float lastLockedEffectTime the locked effect last played, for the cooldown.
private TransformEvent lockedByDependencyEffectEffect played on orbs locked by an unmet dependency.
private float lockedEffectCooldownMinimum seconds between locked effects.
private PlayerProgressionManager managerThe progression manager passed to PrepareOnServer.
private int nextFreeHolderIndex of the holder the next spawned orb goes into.
private Quaternion offsetRotationExtra rotation applied to each placed holder.
private NetworkPrefab orbPrefabPrefab spawned for each bought skill orb.
private BoughtSkillVisualizer.OrbHolderHandle[] placedHoldersThe orb holder handles, one per crystal.
private float radiusRadius of the holder ring.
private bool showFreePointsAvailableWhether free skill points show as open holders. Set by SetPath.
private float verticalOffsetVertical offset of holders from the ring positions.

Properties​

MemberWhat it is
Rigidbody AnchorBody { get; }Rigidbody the bought skill orbs are anchored to.

Methods​

MemberWhat 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
MemberWhat 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: