Skip to main content

AchievementBoard

A class in Root.Township, the global namespace.

Client: a board listing a set of achievements. Hidden until there is a local player, and hidden again once all of them are done.

Constructors​

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

Fields​

8 private and internal fields
MemberWhat it is
private GameAchievement[] achievementsAchievements shown on the board.
private bool isSpreadingWhether spacing is the total length to spread items over instead of the gap between them.
private AchievementItem itemPrefabPrefab for one achievement row.
private LODGroup lodGroupLOD group the item renderers are added to.
private Transform parentTransform the items sit under.
private float spacingGap between items, or the total length when spreading.
private TextRenderer titleThe board title text.
private TaskCompletedEvent[] toSetupThe task completed events on each row, one per achievement.

Methods​

8 private and internal methods
MemberWhat it is
private void CheckEnabled()Hides the board if every achievement is locally completed.
private void InstantiateItems()Spawns an item per achievement down the board. Not called in this build.
private void OnDestroy()Unhooks the player, sync and achievement listeners.
private void OnDrawGizmos()Draws preview meshes for the item layout in the editor.
private void ReceivedSync()Rechecks the board once after the first task sync.
private void Start()Sets up for the current player, or hides the board and waits for the local player.
private void UpdateAchievement(IPlayer player, GameAchievement achievement)Rechecks the board when an achievement is completed.
private void UpdatePlayer(IPlayer player)Hides the board if all achievements are done; otherwise shows it, sets up the items and listens for completions.