Class Memory
A memory is a set of information that a PersonLike can store, related to an activity or event that has happened at a given type. A memory is constructed from an underlying MemoryType. When a subclass extends the IUpdatingMemory interface, its Update(GameTime, TimeSpan, float) method will automatically be called for the Person that has the memory.
[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
Validate(PersonLike)
Validates this memory when the game is loaded. This method is claled in Validate(AppliedMigrations). This method reutrns false if this memory is invalid in some way, causing it to be removed.
public virtual bool Validate(PersonLike person)
Parameters
person
PersonLikeThe person that has this memory.
Returns
- bool
Whether this memory is valid.