MemoryRecord(entity)

Class for representing the memory information about a single game entity.

new MemoryRecord(entity)

Constructs a new memory record.

Parameters:
Name Type Default Description
entity GameEntity null

The game entity that is represented by this memory record.

Author:

Members

nullable entity :GameEntity

The game entity that is represented by this memory record.

Default Value:
  • null

lastSensedPosition :Vector3

Marks the position where the opponent was last sensed.

timeBecameVisible :Number

Records the time the entity became visible. Useful in combination with a reaction time in order to prevent immediate actions.

Default Value:
  • - Infinity

timeLastSensed :Number

Records the time the entity was last sensed (e.g. seen or heard). Used to determine if a game entity can "remember" this record or not.

Default Value:
  • - Infinity

visible :Boolean

Whether this game entity is visible or not.

Default Value:
  • false

Methods

fromJSON(json) → {MemoryRecord}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
MemoryRecord -

A reference to this memory record.

resolveReferences(entities) → {MemoryRecord}

Restores UUIDs with references to GameEntity objects.

Parameters:
Name Type Description
entities Map.<String, GameEntity>

Maps game entities to UUIDs.

Returns:
MemoryRecord -

A reference to this memory record.

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.