ForgeDocs
Documentation for the forge framework
|
An interface of Entity operations that allow the entity to be both queried and written to. More...
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< DataAccessor > | SelectData (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... | |
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.
Data.IData Forge.Entities.IEntity.AddData | ( | DataAccessor | accessor | ) |
Add a Data instance of with the given accessor to the Entity.
Data.IData Forge.Entities.IEntity.AddOrModify | ( | DataAccessor | accessor | ) |
Adds the given data type, or modifies an instance of it.
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.
accessor | The 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.
|
get |
Each entity has a unique identifier. The identifier is never shared by any other entity during the entire simulation of the game.