ForgeDocs
Documentation for the forge framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Forge.Entities.IEntity Interface Reference

An interface of Entity operations that allow the entity to be both queried and written to. More...

Inheritance diagram for Forge.Entities.IEntity:
Forge.Entities.IQueryableEntity

Public Member Functions

void Destroy ()
 Destroys the entity. The entity is not destroyed immediately, but instead at the end of the next update loop. Systems will get a chance to process the destruction of the entity. More...
 
Data.IData AddOrModify (DataAccessor accessor)
 Adds the given data type, or modifies an instance of it. More...
 
Data.IData AddData (DataAccessor accessor)
 Add a Data instance of with the given accessor to the Entity. More...
 
void RemoveData (DataAccessor accessor)
 Removes the given data type from the entity. More...
 
Data.IData Modify (DataAccessor accessor)
 Modify the given data instance. The current and previous values are still accessible. Please note that a data instance can only be modified once; an exception is thrown if one instance is modified multiple times. More...
 
bool WasModified (DataAccessor accessor)
 Returns if the given data was modified in the previous update. More...
 
bool WasAdded (DataAccessor accessor)
 Returns true if the given data was added to the entity in the previous update. More...
 
bool WasRemoved (DataAccessor accessor)
 Returns true if the data was removed from the entity in the previous update. More...
 
- Public Member Functions inherited from Forge.Entities.IQueryableEntity
ICollection< DataAccessorSelectData (bool includeRemoved=false, Predicate< DataAccessor > filter=null, ICollection< DataAccessor > storage=null)
 Selects data inside of the entity that passes the given filter. More...
 
Data.IData Current (DataAccessor accessor)
 Gets the current data value for the given type. More...
 
Data.IVersioned Previous (DataAccessor accessor)
 Gets the previous data value for the data type. More...
 
bool ContainsData (DataAccessor accessor)
 Checks to see if this Entity contains an instance of the given data type. Keep in mind that an IQueryableEntity contains data one frame after it has been removed; both ContainsData(accessor) and WasRemoved(accessor) can return true. More...
 

Properties

int UniqueId [get]
 Each entity has a unique identifier. The identifier is never shared by any other entity during the entire simulation of the game. More...
 
- Properties inherited from Forge.Entities.IQueryableEntity
string PrettyName [get, set]
 A non-unique string that represents a "human readable" name for the entity. This carries no weight in the simulation, and is only meant for diagnostics. More...
 

Detailed Description

An interface of Entity operations that allow the entity to be both queried and written to.

There are numerous extension methods for this interface which make working with it easier, such as generic wrappers for automatically retrieving DataAccessors and casting to the correct return type. It is suggested that the extension methods are used instead of these more primitive ones. The primitive methods are necessary, however, when data type information is not explicitly known at compile-time.

Member Function Documentation

Data.IData Forge.Entities.IEntity.AddData ( DataAccessor  accessor)

Add a Data instance of with the given accessor to the Entity.

Returns
The data instance that can be used to initialize the data
Data.IData Forge.Entities.IEntity.AddOrModify ( DataAccessor  accessor)

Adds the given data type, or modifies an instance of it.

Returns
A modifiable instance of data of type T
void Forge.Entities.IEntity.Destroy ( )

Destroys the entity. The entity is not destroyed immediately, but instead at the end of the next update loop. Systems will get a chance to process the destruction of the entity.

Data.IData Forge.Entities.IEntity.Modify ( DataAccessor  accessor)

Modify the given data instance. The current and previous values are still accessible. Please note that a data instance can only be modified once; an exception is thrown if one instance is modified multiple times.

Parameters
accessorThe data type to modify.
void Forge.Entities.IEntity.RemoveData ( DataAccessor  accessor)

Removes the given data type from the entity.

The data instance is not removed in this frame, but in the next one. In the next frame, Previous and Modify will both throw NoSuchData exceptions, but Current will return the current data instance.

bool Forge.Entities.IEntity.WasAdded ( DataAccessor  accessor)

Returns true if the given data was added to the entity in the previous update.

bool Forge.Entities.IEntity.WasModified ( DataAccessor  accessor)

Returns if the given data was modified in the previous update.

bool Forge.Entities.IEntity.WasRemoved ( DataAccessor  accessor)

Returns true if the data was removed from the entity in the previous update.

Property Documentation

int Forge.Entities.IEntity.UniqueId
get

Each entity has a unique identifier. The identifier is never shared by any other entity during the entire simulation of the game.


The documentation for this interface was generated from the following file: