Skip to main content

TaskCompletedEvent

A class in Root.Township, the global namespace.

Component that fires one of two UnityEvents depending on whether the local player has completed an achievement, and shows its description. Client side.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private TextRenderer descriptionText renderer that shows the achievement's description.
private UnityEvent onCompleteEvent fired when the achievement is complete.
private UnityEvent onNonCompleteEvent fired when the achievement isn't complete yet.
private GameAchievement targetAchievementThe achievement to watch.

Methods​

MemberWhat it is
void SetAchievement(GameAchievement achievement)Sets the target achievement and sets the component up for it.
6 private and internal methods
MemberWhat it is
private void CheckComplete()Runs after a task sync arrives: fires onComplete if the achievement is now done.
private void CheckCompleteTask(IPlayer player, GameAchievement achievement)Fires onComplete when the local player completes the achievement.
private void GetLocalPlayer(IPlayer player)Fires onComplete if already done, otherwise onNonComplete, and starts listening for completion.
private void OnDestroy()Unhooks from the local player and achievement events.
private void Setup()Shows the achievement description and checks the local player, waiting for one if none is set yet.
private void Start()Calls Setup if an achievement is assigned.

Used in​

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