Table of Contents

Class Memory

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

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
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

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 GameTime

The game's time

passedInGame TimeSpan

The amount of time that has passed since the last call

speedMultiplier float

The 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 Person

The person that has this memory.

Returns

bool

Whether this memory is valid.