Skip to main content

SkillShrine

A class in Root.Township, the global namespace.

A progression shrine showing one path's skill tree. When a player opens it, the server spawns a SkillOrb per slot and lines between them; closing removes them. The current path is saved.

Constructors​

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

Fields​

17 private and internal fields
MemberWhat it is
private List<SkillOrbConnectionline> activeConnectionsClient: the connection lines drawn between orbs, destroyed when the shrine closes.
private float connectionShrinkSpeedBacking field for ConnectionShrinkSpeed. Default 0.2.
private ProgressionPath currentPathBacking field for CurrentPath, the progression path this shrine shows. Saved and synced.
private float delayBetweenFirstPracticeAndCloseSeconds to wait after the first practice before ending it. Default 0.5.
private ExperienceFillVisualizer fillVisualizerExperience fill shown for the current path; returned by GetVisualizer.
private Vector2 internalOffsetSerialized offset, default (0.5, 0.5). Not read anywhere in this class.
private PooledObjectDefinition lineDefinitionBacking field for LineDefinition, the pooled line used between orbs.
private int maxPathValueNumber of ProgressionPath values, the upper bound when syncing the path.
private SkillOrbOperator skillOrbOperatorBacking field for SkillOrbOperator.
private Transform skillTreeRayOriginBacking field for SkillTreeRayOrigin; orbs spawn here and fly to their slots.
private Transform skillTreeTargetBacking field for SkillTreeTarget; slot positions are laid out around it.
private NetworkPrefab skilOrbPrefabBacking field for SkilOrbPrefab, the orb spawned for each slot of the skill tree.
private Dictionary<uint, SkillShrine.ApliedSlotTuple> spawnedOrbsMapServer: spawned orbs by slot hash, used to build the connection sync.
private MethodSyncClass<SkillShrine.ConnectionSyncArgument> syncConnectionsSync channel (SyncC) for orb connections.
private MethodSync syncPathSync channel (SyncB) for the current path.
private SkillShrineTestingArea testingAreaBacking field for TestingArea, where players practise a skill.
private SkillShrineVisualizer[] visualizersBacking field for Visualizers; each is told the current path.

Properties​

MemberWhat it is
float ConnectionShrinkSpeed { get; }How fast the lines between orbs shrink away.
ProgressionPath CurrentPath { get; }The progression path whose tree this shrine shows.
PooledObjectDefinition LineDefinition { get; }Pooled object used to draw lines between orbs.
SkillOrbOperator SkillOrbOperator { get; }The skill orb operator for this shrine.
Transform SkillTreeRayOrigin { get; }Where orbs start from when they fly out.
Transform SkillTreeTarget { get; }Centre and rotation the tree's slot positions are laid out from.
NetworkPrefab SkilOrbPrefab { get; }Prefab spawned for each skill orb.
List<SkillOrb> SpawnedOrbs { get; }The orbs currently out.
SkillShrineTestingArea TestingArea { get; }Area that opens while a player practises an orb.
override IEnumerable<SkillShrineVisualizer> Visualizers { get; }The shrine's path visualizers.

Methods​

MemberWhat it is
override ExperienceFillVisualizer GetVisualizer(ProgressionPath path)The experience fill visualizer for the shrine's own path, else null.
override void Initialize()Sets up the synced path and connection messages.
override void InitializeAsServer(SpawnData spawnData)Server: prepares the orb map and sets the visualizers to the current path.
override void OnConnected(Player player)Server: sends the path, the orb connections if open, and the testing area state to a new player.
void SetNewPath(ProgressionPath path)Server: changes the shrine's path and syncs it. Does not reopen the tree.
protected override void CloseInternal()Ends any practice, removes connection lines and, on the server, destroys the spawned orbs.
protected override void OpenOnClient()Client: hooks the testing area to the player's practised-slot event.
protected override void OpenOnServer()Server: spawns an orb for each slot in the path's tree with the player's status and starts watching for practised skills.
protected override void UpdateVisuals(IPlayer player, ProgressionPath updatedPath)Rechecks every orb's status, then updates the base visuals.
7 private and internal methods
MemberWhat it is
private void Awake()Counts the ProgressionPath values for sync bounds and, on clients, creates the connection line list.
private IEnumerator DelayEndPractice() (iterator)Server: waits delayBetweenFirstPracticeAndClose seconds, then ends practice if the same orb is still being practised.
private void OnDrawGizmosSelected()Editor: draws a sphere at the skill tree target.
private void SkillPracticed(IPlayer player, ProfessionSkill skill)Server: hooked to ProfessionSkill.OnSkillExecuted while open. Marks the practising orb's slot practised when its skill runs, and may end practice.
private void SyncConnections(IPlayer player, Stream stream, SkillShrine.ConnectionSyncArgument arguments)Sync handler that sends orb pairs to link; clients create a connection line for each pair.
private void SyncPath(IPlayer player, Stream stream)Sync handler for currentPath; clients update their visualizers to the new path.
private void UpdatePracticing(SkillOrb orb, bool isPracticing, PlayerProgressionManager playerProgressionManager)Opens the testing area for an orb when practice starts and disables it when practice stops.

Used in​

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