Entity Class
Definition
Section titled “Definition”A positioned and animated game object.
[DataContract]public class Entity : ScreenObject, IScreenObject, IPositionable, IComponentHost, IHasIDInheritance object → ScreenObject
Implements IScreenObject, SadRogue.Primitives.IPositionable, IComponentHost, SadRogue.Primitives.IHasID
Constructors
Section titled “Constructors”Entity(Animated, int)
Section titled “Entity(Animated, int)”Creates a new entity as an animated surface.
public Entity(Entity.Animated appearance, int zIndex)Parameters
Section titled “Parameters”appearance Entity.Animated
The surface appearance to use for the entity.
zIndex int
The rendering order. Higher values are drawn on top of lower values.
Entity(AnimatedScreenObject, int)
Section titled “Entity(AnimatedScreenObject, int)”Creates a new entity as an animated surface.
public Entity(AnimatedScreenObject appearance, int zIndex)Parameters
Section titled “Parameters”appearance AnimatedScreenObject
The surface appearance to use for the entity.
zIndex int
The rendering order. Higher values are drawn on top of lower values.
Entity(SingleCell, int)
Section titled “Entity(SingleCell, int)”Creates a new entity as a single cell.
public Entity(Entity.SingleCell appearance, int zIndex)Parameters
Section titled “Parameters”appearance Entity.SingleCell
The single cell appearance to use for the entity.
zIndex int
The rendering order. Higher values are drawn on top of lower values.
Entity(ColoredGlyphBase, int)
Section titled “Entity(ColoredGlyphBase, int)”Creates a new entity, copying the provided appearance to this entity.
public Entity(ColoredGlyphBase appearance, int zIndex)Parameters
Section titled “Parameters”appearance ColoredGlyphBase
The appearance of the entity.
zIndex int
The rendering order. Lower values are under higher values.
Entity(Color, Color, int, int)
Section titled “Entity(Color, Color, int, int)”Creates a new entity, copying the provided appearance to this entity.
public Entity(Color foreground, Color background, int glyph, int zIndex)Parameters
Section titled “Parameters”foreground SadRogue.Primitives.Color
The foreground color of the entity.
background SadRogue.Primitives.Color
The background color of the entity.
glyph int
The glyph color of the entity.
zIndex int
The rendering order. Lower values are under higher values.
Properties
Section titled “Properties”A friendly name of the game object.
[DataMember]public string Name { get; set; }ZIndex
Section titled “ZIndex”The drawing layer this entity is drawn at
[DataMember]public int ZIndex { get; set; }IsDirty
Section titled “IsDirty”Indicates this entity’s visual appearance has changed.
public bool IsDirty { get; set; }UsePixelPositioning
Section titled “UsePixelPositioning”Treats the SadRogue.Primitives.IPositionable.Position of the entity as if it is pixels and not cells.
public bool UsePixelPositioning { get; set; }AppearanceSingle
Section titled “AppearanceSingle”The appearance of the entity when IsSingleCell is true.
public Entity.SingleCell? AppearanceSingle { get; set; }AppearanceSurface
Section titled “AppearanceSurface”The appearance of the entity when IsSingleCell is false.
public Entity.Animated? AppearanceSurface { get; set; }IsSingleCell
Section titled “IsSingleCell”When true, indicates that this entity is a single cell entity; otherwise false and it’s an animated surface entity.
public bool IsSingleCell { get; set; }Methods
Section titled “Methods”OnPositionChanged(Point, Point)
Section titled “OnPositionChanged(Point, Point)”Raises the PositionChanged event.
protected override void OnPositionChanged(Point oldPosition, Point newPosition)Parameters
Section titled “Parameters”oldPosition SadRogue.Primitives.Point
The previous position.
newPosition SadRogue.Primitives.Point
The new position.
OnIsDirtyChanged()
Section titled “OnIsDirtyChanged()”Raises the IsDirtyChanged event.
protected virtual void OnIsDirtyChanged()UpdateAbsolutePosition()
Section titled “UpdateAbsolutePosition()”Sets a value for AbsolutePosition based on the SadRogue.Primitives.IPositionable.Position of this instance and the Parent instance.
public override void UpdateAbsolutePosition()Update(TimeSpan)
Section titled “Update(TimeSpan)”If an effect is applied to the cell, updates the effect.
public override void Update(TimeSpan delta)Parameters
Section titled “Parameters”delta TimeSpan
ToString()
Section titled “ToString()”Returns the name of the entity prefixed with “Entity - ”.
public override string ToString()Returns
Section titled “Returns”string
The name.
Save(string)
Section titled “Save(string)”Saves the Entity to a file.
public void Save(string file)Parameters
Section titled “Parameters”file string
The destination file.
Load(string)
Section titled “Load(string)”Loads a Entity from a file.
public static Entity Load(string file)Parameters
Section titled “Parameters”file string
The source file.
Returns
Section titled “Returns”Entity
The entity.
Events
Section titled “Events”IsDirtyChanged
Section titled “IsDirtyChanged”Raised when the IsDirty property changes value.
public event EventHandler? IsDirtyChanged