Job - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Goals

Job Class

A job is a kind of work that a Person can have.
The person's current job is accessible using Job.
A job instance is constructed from its underlying JobType.

public class Job : MLEM.Misc.GenericDataHolder

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 Job

Constructors

Job.Job(JobType, Person) Constructor

Creates a new job from the given settings

public Job(TinyLife.Goals.JobType type, TinyLife.Objects.Person person);

Parameters

type JobType
The underlying job type

person Person
The person that should have this job

Fields

Job.MaxLevel Field

The maximum level that a Job can have.
A job's level goes from 0 to this value, inclusively.

public const int MaxLevel = 9;

Field Value

System.Int32

Job.Type Field

The underlying JobType that this job results from

public readonly JobType Type;

Field Value

JobType

Properties

Job.CurrentHourlyPay Property

The amount of tiny bucks that this job pays per hour. This is based on HourlyPay and the current Level.

public float CurrentHourlyPay { get; }

Property Value

System.Single

Job.Level Property

The current level that this job is at.
Note that the default level is 0, and the level goes up to a maximum of MaxLevel.

public int Level { get; set; }

Property Value

System.Int32

Job.Performance Property

This job's current performance, ranging from 0 to 1, representing the percentage of work performance.
The default value is 0.5.

public float Performance { get; set; }

Property Value

System.Single

Job.Person Property

The Person that currently has this job

public TinyLife.Objects.Person Person { get; set; }

Property Value

Person

Methods

Job.AddLevel(int) Method

Adds (or removes) the given amount of levels to this job's Level.
Note that the level value is automatically clamped between 0 and MaxLevel, inclusively.

public void AddLevel(int level);

Parameters

level System.Int32
The level to add to this job's current level

Job.AddPerformance(float) Method

Adds (or removes) the given amount of performance to this job's Performance.
If the total Performance rolls over (below 0 or above 1), AddLevel(int) is called and the performace is reset accordingly.

public void AddPerformance(float performance);

Parameters

performance System.Single
The amount to add or remove to the current performance

Job.HasRequiredPromotionSkills() Method

Checks whether this job's Person has all of the RequiredPromotionSkills

public bool HasRequiredPromotionSkills();

Returns

System.Boolean
Whether the skills required for promotion are present

Job.Update(TimeSpan) Method

Updates this job, changing the Performance and Level according to this job's person's current actions.
This is called in Update(GameTime, TimeSpan, GameSpeed).

public void Update(System.TimeSpan passedInGame);

Parameters

passedInGame System.TimeSpan
The amount of time that has passed in game since the last update

Job.Validate(Person) Method

This method is called when this object is loaded from disk.

public bool Validate(TinyLife.Objects.Person person);

Parameters

person Person

Returns

System.Boolean
false if the object is not valid, true otherwise