Table of Contents

Class Job

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

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

[DataContract]
public class Job : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
Job
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Job(JobType, Person, int)

Creates a new job from the given settings

public Job(JobType type, Person person, int level)

Parameters

type JobType

The underlying job type

person Person

The person that should have this job

level int

The level to start out with this job at

Fields

Type

The underlying JobType that this job results from

[DataMember]
public readonly JobType Type

Field Value

JobType

VacationDaysAvailable

The amount of vacation days currently available.

[DataMember]
public int VacationDaysAvailable

Field Value

int

Properties

AmountOfRaises

The amount of raises that this job instance has been given. A raise is given after the MaxLevel is reached and the Performance reaches RequiredPromotionPerformance.

[DataMember]
public int AmountOfRaises { get; }

Property Value

int

CurrentHourlyPay

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

public float CurrentHourlyPay { get; }

Property Value

float

DailyTasks

A goal set that represents the daily tasks for this job

[DataMember]
public GoalSet DailyTasks { get; }

Property Value

GoalSet

DaysOnVacation

The amount of days remaining on the current vacation. If this value is 0, this job is not currently on vacation. Use StartVacation(int, float) to edit this value.

[DataMember]
public int DaysOnVacation { get; }

Property Value

int

Level

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.

[DataMember]
public int Level { get; }

Property Value

int

Performance

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

[DataMember]
public float Performance { get; }

Property Value

float

Person

The Person that currently has this job

public Person Person { get; }

Property Value

Person

RequiredPromotionPerformance

The amount of Performance required to be promoted at the current level. This is based on the Level, as well as the AmountOfRaises.

public float RequiredPromotionPerformance { get; }

Property Value

float

Methods

AddLevel(int)

Adds (or removes) the given amount of levels to this job's Level. Note that the resulting total level is clamped to MaxLevel, and that this does not change the Performance value.

public bool AddLevel(int level)

Parameters

level int

The level to add to this job's current level

Returns

bool

Whether the level could be added (which is not the case if Level is already at MaxLevel).

AddPerformance(float)

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 float

The amount to add or remove to the current performance

GetCoworkers()

Returns all of the people on the Map that also have this job.

public IEnumerable<Person> GetCoworkers()

Returns

IEnumerable<Person>

This person's coworkers.

GetCoworkersAtWork()

Returns all of the people on the Map that also have this job, and are currently at work.

public IEnumerable<Person> GetCoworkersAtWork()

Returns

IEnumerable<Person>

This person's currently working coworkers.

GetRaise()

Gives the Person that has this job a raise. This causes the AmountOfRaises to be increased, which increases the CurrentHourlyPay. Note that this method will return false if the Level has not reached the MaxLevel.

public bool GetRaise()

Returns

bool

Whether a raise could successfully be given.

HasRequiredPromotionSkills()

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

public bool HasRequiredPromotionSkills()

Returns

bool

Whether the skills required for promotion are present

StartVacation(int, float)

Starts a vacation for the given amount of days with the given payModifier.

public void StartVacation(int days, float payModifier = 1)

Parameters

days int

The amount of days.

payModifier float

The amount that the daily pay on vacation should be multiplied with, defaults to 1.

Update(TimeSpan)

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

public void Update(TimeSpan passedInGame)

Parameters

passedInGame TimeSpan

The amount of time that has passed in game since the last update

UpdateWorking(WorkAction, TimeSpan, float)

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

public void UpdateWorking(WorkAction action, TimeSpan passedInGame, float speedMultiplier)

Parameters

action WorkAction

The action that is currently being executed.

passedInGame TimeSpan

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

speedMultiplier float

The game's current speed multiplier.

Validate(Person)

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

public bool Validate(Person person)

Parameters

person Person

Returns

bool

false if the object is not valid, true otherwise

Events

OnGetWorkingPerformance

An event that is raised when this job's Performance is increased in Update(TimeSpan). This event can be used to change the gained or lost performance due to various custom conditions.

public static event Job.JobPerformanceDelegate OnGetWorkingPerformance

Event Type

Job.JobPerformanceDelegate