Skip to main content

ProfessionSkill

An abstract class in Root.Township, the global namespace.

Base for a skill in a progression tree: a hashed asset that players unlock and practise. Subclasses ProfessionSkill<T> keep a static Instance for checks like PlayerUnlocked.

Constructors​

MemberWhat it is
protected ProfessionSkill()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

MemberWhat it is
protected static Logger loggerNLog logger shared by profession skills.
6 private and internal fields
MemberWhat it is
private static Dictionary<uint, ProfessionSkill.ActiveEffect> activeEffectsShared map of entity identifier to its pooled tool effect, so several skills can share one effect on a tool.
private List<PositionedNetworkPrefab> dynamicContentPrefabsBacking field for DynamicContentPrefabs.
private Sprite[] practiceGlyphSpritesBacking field for PracticeGlyphSprites.
private uint skillPracticeTriggerHash of the skill whose practice counts for this one. 0 means this skill's own hash.
private List<PositionedStaticPrefab> staticContentPrefabsBacking field for StaticContentPrefabs.
private GameAchievement targetAchievementAchievement completed for the player by CompleteTargetAchievement (server only).

Properties​

MemberWhat it is
List<PositionedNetworkPrefab> DynamicContentPrefabs { get; }Network prefabs a skill shrine testing area spawns when this skill's orb is opened.
Sprite[] PracticeGlyphSprites { get; }Glyph images shown to show the player how to practise the skill.
uint SkillPracticeTrigger { get; }Hash of the skill whose execution counts as practice for this one. Defaults to this skill's own hash.
List<PositionedStaticPrefab> StaticContentPrefabs { get; }Static prefabs a skill shrine testing area places when this skill's orb is opened.

Events​

MemberWhat it is
static event ProfessionSkillDelegate OnSkillExecutedStatic event raised whenever any skill fires; skill shrines use it to count practice.

Methods​

MemberWhat it is
void CompleteTargetAchievement(PlayerProgressionManager player)Server: completes this skill's linked achievement for the player.
virtual void Lock(PlayerProgressionManager player)Called when a player loses the skill. Empty in the base class.
static void ReleaseEffect(NetworkEntity entity, ProfessionSkill skill)Static: drops one skill's request for the shared tool effect on an entity. The effect goes when no skill still wants it.
static void ReleaseEffect(uint identifier, ProfessionSkill skill, bool isForced = false)Static: drops one skill's request for the shared tool effect on an entity. The effect goes when no skill still wants it.
static void RequestEffect(NetworkEntity entity, ProfessionSkill skill, out ToolBasedEffectBase effect)Static: gets the shared tool glow effect for an entity, creating it if needed. Extra skills get a dissipate effect instead.
virtual void SendSerializedMessage(IPlayer player, Stream stream)Reads or writes extra skill data in a progression skill message to one player. Empty in the base class.
virtual void Unlock(PlayerProgressionManager player)Called when a player gains the skill. In ProfessionSkill<T> this also sets the static Instance.
protected void ExecuteSkill(IPlayer player)Raises OnSkillExecuted for the player. Subclasses call it when the skill fires.
protected virtual void ReleaseToolEffect(NetworkEntity entity)Releases this skill's tool effect on an entity.
protected virtual void RequestToolEffect(NetworkEntity entity)Requests the tool effect for an entity and starts it.

Used in​

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