Class LotEmployment.Instance
An instance of a LotEmployment. This is used by LotEmployment to store additional info about their employment.
[DataContract]
public class LotEmployment.Instance
- Inheritance
-
LotEmployment.Instance
- Inherited Members
- Extension Methods
Constructors
Instance(Person, Map, Lot, LotEmployment, bool)
Creates a new lot employment instance with the given settings
public Instance(Person person, Map map, Lot employmentLot, LotEmployment type, bool setManually)
Parameters
person
PersonThe person to be employed
map
MapThe map that this lot employment is for.
employmentLot
LotThe lot to be employed on, or null for a MapWideEmployments entry
type
LotEmploymentThe lot employment
setManually
boolWhether this person was set manually (by a user) or automatically (using UpdateExternalPeople(ICollection<Map>, Action<string>, Action<float>)
Fields
IsAtWork
Whether this lot employment's employee is currently at work.
[DataMember]
public bool IsAtWork
Field Value
TimeAtWork
The amount of time that this lot employment's employee has been at work for. If IsAtWork is false, this is Zero.
[DataMember]
public TimeSpan TimeAtWork
Field Value
Properties
EmploymentLot
The lot that this employment is active on. If this is a map-wide employment, this is null. See WorkLot for the lot that this employment is currently working on.
public Lot EmploymentLot { get; }
Property Value
Map
The map that this lot employment instance's Lot is on.
public Map Map { get; }
Property Value
SetManually
Whether this person was set manually (by a user) or automatically (using UpdateExternalPeople(ICollection<Map>, Action<string>, Action<float>)
[DataMember]
public bool SetManually { get; }
Property Value
Type
The underlying LotEmployment type of this instance
public LotEmployment Type { get; }
Property Value
WorkLot
The lot that the person with this employment is working on. If this is not a map-wide employment, EmploymentLot is always returned, even if this property has been overwritten.
public Lot WorkLot { get; set; }
Property Value
Methods
FinishWork(bool)
A method that is invoked while this employment's employee is at work, when there is no more work to be done. This method causes the appropriate money to be deducted and earned if ForHireOnce is true, and causes IsAtWork and TimeAtWork to be set accordingly.
public void FinishWork(bool notify = true)
Parameters
ShouldWorkRightNow()
Returns whether the Time is in range of this LotEmployment's WorkHours and OffWorkDays and it is not IsFinished.
public bool ShouldWorkRightNow()
Returns
- bool
Whether work needs to be done right now.
Validate(Person)
This method is called when this object is loaded from disk. Returning false on this method causes the object to be removed from the map.
public bool Validate(Person person)
Parameters
person
PersonThe person to validate this lot employment for
Returns
- bool
false if the object is not valid, true otherwise