Table of Contents

Class Memory

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

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
JsonTypeSafeGenericDataHolder
Memory
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 MemoryType

The type of this memory.

info ActionInfo

The ActionInfo that contains information about this memory.

timeOccured TimeSpan

The in-game time that this event occured at.

Fields

Type

The type of this memory.

[DataMember]
public readonly MemoryType Type

Field Value

MemoryType

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

ActionInfo

TimeOccured

The in-game time that this event occured at.

[DataMember]
public TimeSpan TimeOccured { get; protected set; }

Property Value

TimeSpan

TimeSinceOccured

Returns the time since this memory occured. This uses Time and TimeOccured.

public TimeSpan TimeSinceOccured { get; }

Property Value

TimeSpan

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 PersonLike

The person that has this memory.

Returns

bool

Whether this memory is valid.