Skill - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Skills

Skill Class

A skill is an ability that a Person can have which influences their behavior in some way.
Skill instances are created from their corresponding SkillType.

public class Skill

Inheritance System.Object 🡒 Skill

Constructors

Skill.Skill(SkillType) Constructor

Creates a new skill instance from the given SkillType.

public Skill(TinyLife.Skills.SkillType type);

Parameters

type SkillType
The type of skill to construct

Fields

Skill.Type Field

The underlying SkillType that this skill instance originates from

public readonly SkillType Type;

Field Value

SkillType

Properties

Skill.Level Property

The current level of this skill. Note that this value never goes beyond MaxLevel.
To modify this value, use Gain(Person, float) or GainSkill(SkillType, float, GameSpeed).

public int Level { get; set; }

Property Value

System.Int32

Skill.LevelPercentage Property

The percentage of Level out of the total MaxLevel that this skill can get to.
This value is always between 0 and 1.

public float LevelPercentage { get; }

Property Value

System.Single

Skill.PointPercentage Property

The percentage of PointsToNextLevel out of the required GetRequiredPointsToNextLevel().
This value is always between 0 and 1.

public float PointPercentage { get; }

Property Value

System.Single

Skill.PointsToNextLevel Property

The amount of skill points that are required until the next Level is reached.
To modify this value, use Gain(Person, float) or GainSkill(SkillType, float, GameSpeed).

public float PointsToNextLevel { get; set; }

Property Value

System.Single

Methods

Skill.Gain(Person, float) Method

Causes the given person to gain a certain amount of points of this skill.
Note that GainSkill(SkillType, float, GameSpeed) is preferred to this method.

public void Gain(TinyLife.Objects.Person person, float amount);

Parameters

person Person
The person that has this skill

amount System.Single
The amount to gain the skill by

Skill.GetRequiredPointsToNextLevel() Method

Returns the amount of skill points that is required to reach the next level.
This value is depenedent on the current Level, meaning higher skill levels are harder to reach.

public int GetRequiredPointsToNextLevel();

Returns

System.Int32
The points required for the next level