Class Job
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
-
JsonTypeSafeGenericDataHolderJob
- 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
JobTypeThe underlying job type
person
PersonThe person that should have this job
level
intThe level to start out with this job at
Fields
Migrations
The set of migrations that will be applied to all loaded Job instances when loading from disk. To register a migration that should only be applied to specific job types, use Migrations.
public static readonly List<Migration<Job>> Migrations
Field Value
Type
The underlying JobType that this job results from
[DataMember]
public readonly JobType Type
Field Value
VacationDaysAvailable
The amount of vacation days currently available.
[DataMember]
public int VacationDaysAvailable
Field Value
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
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
DailyTasks
A goal set that represents the daily tasks for this job
[DataMember]
public GoalSet DailyTasks { get; }
Property Value
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
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
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
Person
The Person that currently has this job
public Person Person { get; }
Property Value
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
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
intThe level to add to this job's current level
Returns
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
floatThe 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
intThe amount of days.
payModifier
floatThe 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
TimeSpanThe 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
WorkActionThe action that is currently being executed.
passedInGame
TimeSpanThe amount of time that has passed in game since the last update.
speedMultiplier
floatThe game's current speed multiplier.
Validate(Person, AppliedMigrations)
This method is called when this object is loaded from disk.
public bool Validate(Person person, AppliedMigrations appliedMigrations)
Parameters
person
PersonappliedMigrations
AppliedMigrations
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