Class EntityBase<TCoordinates, TTemplate>
- Namespace
- AlphaFramework.World.Positionables
- Assembly
- AlphaFramework.World.dll
A common base class for Positionable<TCoordinates> whose behaviour and graphical representation is controlled by components.
public abstract class EntityBase<TCoordinates, TTemplate> : Positionable<TCoordinates>, ICloneable, IChangeNotify<Positionable<TCoordinates>>, IUpdateable, ITemplated where TCoordinates : struct where TTemplate : EntityTemplateBase<TTemplate>
Type Parameters
TCoordinates
Data type for storing position coordinates of objects in the game world.
TTemplate
The specific type of EntityTemplateBase<TSelf> to use as a component container.
- Inheritance
-
Positionable<TCoordinates>EntityBase<TCoordinates, TTemplate>
- Implements
-
IChangeNotify<Positionable<TCoordinates>>
- Derived
- Inherited Members
- Extension Methods
Properties
CurrentPath
The path this entity is currently walking along.
[Browsable(false)]
public StoredPath<TCoordinates>? CurrentPath { get; set; }
Property Value
- StoredPath<TCoordinates>
TemplateData
The TTemplate
controlling the behavior and look for this EntityBase<TCoordinates, TTemplate>.
[Browsable(false)]
public TTemplate? TemplateData { get; set; }
Property Value
- TTemplate
Remarks
This is always a clone of the original TTemplate
.
This is serialized/stored in savegames but not in map files!
TemplateName
The name of the TTemplate
.
public string? TemplateName { get; set; }
Property Value
Remarks
Setting this will overwrite TemplateData with a new clone of the appropriate TTemplate
.
This is serialized/stored in map files. It is also serialized/stored in savegames, but the value is ignored there (due to the attribute order)!
Methods
Clone()
Creates a deep copy of this EntityBase<TCoordinates, TTemplate>.
public override Positionable<TCoordinates> Clone()
Returns
- Positionable<TCoordinates>
The cloned EntityBase<TCoordinates, TTemplate>.
MaskTemplateData()
Makes all TemplateData values return null
until Dispose() is called on the returned object. This is not thread-safe!
public static IDisposable MaskTemplateData()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Update(double)
Updates the position and other attributes of this entity.
public abstract void Update(double elapsedTime)
Parameters
elapsedTime
doubleHow much game time in seconds has elapsed since this method was last called.