Class AnimatedAppearanceComponent
A component for Entity that animates the AppearanceSingle property.
Implements
Inherited Members
Namespace: SadConsole.Entities
Assembly: SadConsole.dll
Syntax
[DataContract]
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class AnimatedAppearanceComponent : UpdateComponent, IComponent
Constructors
AnimatedAppearanceComponent()
Declaration
public AnimatedAppearanceComponent()
Properties
AnimationTime
The total time it takes to play all Frames.
Declaration
public TimeSpan AnimationTime { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Frames
The frames of animation.
Declaration
public ColoredGlyphAndEffect[] Frames { get; set; }
Property Value
Type | Description |
---|---|
ColoredGlyphAndEffect[] |
IsRepeatable
When true, the animation will automatically restart after the last frame is applied. Otherwise, false and the animation stops when completed.
Declaration
public bool IsRepeatable { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
OnAdded(IScreenObject)
Called by the component system when this component is added to an object. Must be of type Entity.
Declaration
public override void OnAdded(IScreenObject host)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The component host. |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidCastException | This component was added to a type other than Entity. |
OnRemoved(IScreenObject)
Called by the component system when this component is removed from an object.
Declaration
public override void OnRemoved(IScreenObject host)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The component host. |
Overrides
Restart()
Restarts the animation at the first frame.
Declaration
public void Restart()
Start()
Starts the animation and immediately applies the current frame to the entity.
Declaration
public void Start()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The animation was started but there aren't any frames to animate. |
Stop()
Stops the animation.
Declaration
public void Stop()
Update(IScreenObject, TimeSpan)
Updates the animation frame index and applies the animation to the entity.
Declaration
public override void Update(IScreenObject host, TimeSpan delta)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The component host. |
TimeSpan | delta | The time between calls to this method. |