Class Fridge
A fridge is a Furniture that can contain a set of Items that a Person can interact with. For any Items that are food, their ExpirationTime is increased while in a fridge.
public class Fridge : Furniture, IGenericDataHolder, IUpdatingObject
- Inheritance
-
JsonTypeSafeGenericDataHolderFridge
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
Fridge(Guid, FurnitureType, int[], Map, Vector2)
Creates a new furniture instance. By default, this is done using Construct<T>(int[], Map, Vector2, Guid?).
public Fridge(Guid id, FurnitureType type, int[] colors, Map map, Vector2 pos)
Parameters
id
GuidThe id to apply to the created furniture instance
type
FurnitureTypeThe type to create an instance of
colors
int[]The colors to apply to the furniture
map
MapThe map to create the furniture on
pos
Vector2The position that the furniture should have
Fields
Items
The items that this fridge contains. To add or remove items to or from this fridge, simply modify this collection.
[DataMember]
public readonly HashSet<Furniture> Items
Field Value
Properties
IsMinorUpdateNow
A property that returns whether this updating object should currently update minorly, rather than majorly. A minor update means that Update(GameTime, TimeSpan, float) is only called once every 10 in-game minutes (see MinorUpdateMinutes), but all of the parameters to Update(GameTime, TimeSpan, float) are modified accordingly to maintain proper time calculations. Note that this property is only queried every 10 in-game minutes, as switching between major and minor update schedules only happens when a minor update is executed. For example, a Person updates minorly when they're out of town to aid the game's performance.
public bool IsMinorUpdateNow { get; }
Property Value
Methods
Update(GameTime, TimeSpan, float)
The update method, which is called every update frame by the underlying Map, as well as additional places like the FurnitureStorage. Because of this, some actions might only want to be invoked if an object IsInWorld. To call this method while invoking all required events, use DoUpdate(GameTime, TimeSpan, float).
public void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)
Parameters
time
GameTimeThe game's time
passedInGame
TimeSpanThe amount of time that has passed since the last call
speedMultiplier
floatThe game speed multiplier, which represents how fast things should happen, which is usually determined by Speed
Validate()
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. By default, this method invokes OnValidated and OnEventsAttachable.
public override bool Validate()
Returns
- bool
false if the object is not valid, true otherwise