Skip to main content

ExperienceFillVisualizer

A class in Root.Township, the global namespace.

Skill shrine visual that fills with a player's XP toward the next level on one path, and animates buying and selling skills. The server sends the values; clients animate.

Constructors​

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

Fields​

15 private and internal fields
MemberWhat it is
private static readonly int _FillProgressShader property ID for the main fill amount.
private static readonly int _NegativeChangeProgressShader property ID for the fill shown while selling points.
private static readonly int _PositiveChangeProgressShader property ID for the fill gained, shown while buying.
private Coroutine animationCoroutineThe running fill animation, stopped before a new one starts.
private AvailablePointVisualizerManager availablePointVisualizerShows the orbs for free skill points.
private float currentFillValueCurrent fill from 0 to 1, progress to the next level.
private int currentFreePointsFree skill points on this path, synced from the server.
private AnimationCurve fillingCurveEasing for that fill.
private float fillToTargetTimeSeconds to fill to current progress after opening. Default 0.7.
private bool hasSoldTrue once selling has gone past a full level and a temporary point orb is showing.
private bool isOpenTrue while the shrine is open for a player.
private float openingAnimationTimeSeconds the per-point fill animation takes in total. Default 2.
private Renderer rendererToAnimateBacking field for RendererToAnimate, whose material gets the fill values.
private AnimationCurve sellingProgressCurve for how the fill moves while selling.
private float soldFillProgressFill level after refunding experience by selling a point, worked out by the server in Serialize.

Properties​

MemberWhat it is
Renderer RendererToAnimate { get; }The renderer whose fill shader values are animated.

Methods​

MemberWhat it is
override void Disable()Empties the fill and hides the available points.
void FinishBuy(bool wasConfirmed)Animates the end of a buy, confirmed or cancelled.
void FinishSell()Clears the sell preview and restores the normal fill.
override void PrepareOnServer(PlayerProgressionManager manager)On a non-headless host, reads the player's progress and animates.
override void Serialize(Stream stream, PlayerProgressionManager manager)Server writes free points, fill toward the next level and the fill after a sale; clients read them and animate.
void SetBuyProgress(float progress)Shows the fill draining while a buy is held.
void SetSellProgress(float progress)Shows the fill rising toward the after-sale value while a sell is held.
protected virtual void OpenInternal()Hook for subclasses when the visualizer first opens. Empty in the base class.
6 private and internal methods
MemberWhat it is
private void Animate(float percentageToNextLevel)Fades the fill to a new level if the shrine is open; otherwise opens it with the level-up animation.
private IEnumerator AnimateBuyFinish(bool wasConfirmed) (iterator)Coroutine that settles the fill after buying a point, confirmed or cancelled.
private IEnumerator AnimateOpenForPlayer(int levels, float percentageToNextLevel) (iterator)Coroutine run when the shrine opens: fills once per free point, opening each point visual, then fills to current progress.
private void Awake()Client: resets the fill shader values to 0.
private IEnumerator FadeTo(float target) (iterator)Coroutine that lerps the fill to a target value.
private void OnDestroy()Client: cleans up the material instance it made.

Used in​

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