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.
- Listed in Global namespace: S
- Inherits or implements
ProgressionShrine,ISavable<SkillShrineSaveData>,ISavableSave<SkillShrineSaveData>,ISavableSaveBase - Derived types
SkillShrineSaveData - Nested types
ApliedSlotTuple,ConnectionSyncArgument,NewPathArgument
Constructors
| Member | What it is |
|---|---|
SkillShrine() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
17 private and internal fields
| Member | What it is |
|---|---|
private List<SkillOrbConnectionline> activeConnections | Client: the connection lines drawn between orbs, destroyed when the shrine closes. |
private float connectionShrinkSpeed | Backing field for ConnectionShrinkSpeed. Default 0.2. |
private ProgressionPath currentPath | Backing field for CurrentPath, the progression path this shrine shows. Saved and synced. |
private float delayBetweenFirstPracticeAndClose | Seconds to wait after the first practice before ending it. Default 0.5. |
private ExperienceFillVisualizer fillVisualizer | Experience fill shown for the current path; returned by GetVisualizer. |
private Vector2 internalOffset | Serialized offset, default (0.5, 0.5). Not read anywhere in this class. |
private PooledObjectDefinition lineDefinition | Backing field for LineDefinition, the pooled line used between orbs. |
private int maxPathValue | Number of ProgressionPath values, the upper bound when syncing the path. |
private SkillOrbOperator skillOrbOperator | Backing field for SkillOrbOperator. |
private Transform skillTreeRayOrigin | Backing field for SkillTreeRayOrigin; orbs spawn here and fly to their slots. |
private Transform skillTreeTarget | Backing field for SkillTreeTarget; slot positions are laid out around it. |
private NetworkPrefab skilOrbPrefab | Backing field for SkilOrbPrefab, the orb spawned for each slot of the skill tree. |
private Dictionary<uint, SkillShrine.ApliedSlotTuple> spawnedOrbsMap | Server: spawned orbs by slot hash, used to build the connection sync. |
private MethodSyncClass<SkillShrine.ConnectionSyncArgument> syncConnections | Sync channel (SyncC) for orb connections. |
private MethodSync syncPath | Sync channel (SyncB) for the current path. |
private SkillShrineTestingArea testingArea | Backing field for TestingArea, where players practise a skill. |
private SkillShrineVisualizer[] visualizers | Backing field for Visualizers; each is told the current path. |
Properties
| Member | What 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
| Member | What 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
| Member | What 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: