ForgeDocs
Documentation for the forge framework
|
Used for creating IEntity instances that have a set of data values already initialized. Templates should not be modified at runtime. More...
Public Member Functions | |
IEntity | Instantiate () |
Instantiates the template to create a new IEntity instance. The IEntity is automatically registered with the IGameEngine that owns this template reference. The spawned IEntity will be added to systems on the next update call. The returned entity can be freely modified; modifications can be viewed as pre-initialization. More... | |
void | AddDefaultData (Data.IData data) |
Adds a default data instance to the template. The template "owns" the passed data instance; a copy is not made of it. More... | |
bool | RemoveDefaultData (DataAccessor accessor) |
Remove the given type of data from the template instance. New instances will not longer have this added to the template. 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 | TemplateId [get] |
Each ITemplate can be uniquely identified by its TemplateId. 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... | |
Used for creating IEntity instances that have a set of data values already initialized. Templates should not be modified at runtime.
For example, a generic Orc type will have an ITemplate that defines an Orc. Spawning code will then receive the Orc ITemplate, and when it comes time to spawn it will instantiate an entity from the template, and that entity will be a derivative instance of the original Orc.
void Forge.Entities.ITemplate.AddDefaultData | ( | Data.IData | data | ) |
Adds a default data instance to the template. The template "owns" the passed data instance; a copy is not made of it.
If the ITemplate is currently being backed by an IGameEngine, this will throw an InvalidOperationException. Templates that are being used in an IGameEngine cannot be modified.
data | The data instance to copy from. |
IEntity Forge.Entities.ITemplate.Instantiate | ( | ) |
Instantiates the template to create a new IEntity instance. The IEntity is automatically registered with the IGameEngine that owns this template reference. The spawned IEntity will be added to systems on the next update call. The returned entity can be freely modified; modifications can be viewed as pre-initialization.
bool Forge.Entities.ITemplate.RemoveDefaultData | ( | DataAccessor | accessor | ) |
Remove the given type of data from the template instance. New instances will not longer have this added to the template.
If the ITemplate is currently being backed by an IGameEngine, this will throw an InvalidOperationException.
accessor | The type of data to remove. |
|
get |
Each ITemplate can be uniquely identified by its TemplateId.