Class Memory
A memory is a set of information that a Person can store, related to an activity or event that has happened at a given type. A memory is constructed from an underlying MemoryType.
[DataContract]
public class Memory : JsonTypeSafeGenericDataHolder, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderMemory
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
Memory(MemoryType, ActionInfo, TimeSpan)
Creates a new memory with the given settings. In most cases, Construct<T>(ActionInfo, TimeSpan) should be used instead.
public Memory(MemoryType type, ActionInfo info, TimeSpan timeOccured)
Parameters
type
MemoryTypeThe type of this memory.
info
ActionInfoThe ActionInfo that contains information about this memory.
timeOccured
TimeSpanThe in-game time that this event occured at.
Fields
Type
The type of this memory.
[DataMember]
public readonly MemoryType Type
Field Value
Properties
Info
This memory's ActionInfo, which contains information about when and how this memory was gained.
[DataMember]
public ActionInfo Info { get; protected set; }
Property Value
TimeOccured
The in-game time that this event occured at.
[DataMember]
public TimeSpan TimeOccured { get; protected set; }
Property Value
TimeSinceOccured
Returns the time since this memory occured. This uses Time and TimeOccured.
public TimeSpan TimeSinceOccured { get; }
Property Value
Methods
Update(GameTime, TimeSpan, float)
A method that is called in Update(GameTime, TimeSpan, float) for a person who has this memory.
public virtual 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(Person)
Validates this memory when the game is loaded. This method is claled in Validate(). This method reutrns false if this memory is invalid in some way, causing it to be removed.
public virtual bool Validate(Person person)
Parameters
person
PersonThe person that has this memory.
Returns
- bool
Whether this memory is valid.