Class AttachableObject
Abstract class that represents an object that can be attached to the system. It implements the default life cycle Detached-Deactivated-Activated-Destroyed.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework
Assembly: Evergine.Framework.dll
Syntax
public abstract class AttachableObject : DependencyObject, IDependencyObject
Constructors
AttachableObject()
Initializes a new instance of the AttachableObject class.
Declaration
public AttachableObject()
AttachableObject(AttachableObjectState, bool, bool)
Initializes a new instance of the AttachableObject class.
Declaration
public AttachableObject(AttachableObjectState initialState, bool isLoaded, bool isStarted)
Parameters
Type | Name | Description |
---|---|---|
AttachableObjectState | initialState | The initial state. |
bool | isLoaded | The value indicating whether it is loaded. |
bool | isStarted | The value indicating whether it is started. |
Properties
IsActivated
Gets a value indicating whether this object has started.
Declaration
public virtual bool IsActivated { get; }
Property Value
Type | Description |
---|---|
bool |
IsAttached
Gets a value indicating whether this object is active.
Declaration
public virtual bool IsAttached { get; }
Property Value
Type | Description |
---|---|
bool |
IsDestroyed
Gets a value indicating whether this object has been destroyed.
Declaration
public virtual bool IsDestroyed { get; }
Property Value
Type | Description |
---|---|
bool |
IsEnabled
Gets or sets a value indicating whether this entity is enabled.
Declaration
public virtual bool IsEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsLoaded
Gets a value indicating whether this object is loaded.
Declaration
public virtual bool IsLoaded { get; }
Property Value
Type | Description |
---|---|
bool |
IsStarted
Gets a value indicating whether this object has started.
Declaration
public virtual bool IsStarted { get; }
Property Value
Type | Description |
---|---|
bool |
ShouldBeActivated
Gets a value indicating whether this object should be activated.
Declaration
protected virtual bool ShouldBeActivated { get; }
Property Value
Type | Description |
---|---|
bool |
State
Gets the current state.
Declaration
public AttachableObjectState State { get; }
Property Value
Type | Description |
---|---|
AttachableObjectState |
Methods
DependencyBroken()
A required dependency for this object is broken.
Declaration
protected override void DependencyBroken()
Overrides
Destroy()
Destroys this object.
Declaration
public virtual void Destroy()
OnActivated()
Invoked when the object is activated once it is attached.
Declaration
protected abstract void OnActivated()
OnAttached()
Invoked when the object is attached to the system.
Declaration
protected abstract bool OnAttached()
Returns
Type | Description |
---|---|
bool | True if everything is OK. |
OnDeactivated()
Invoked when the object is deactivated.
Declaration
protected abstract void OnDeactivated()
OnDestroy()
Invoked when the object is about to be disposed.
Declaration
protected abstract void OnDestroy()
OnDetach()
Invoked when the object is detached.
Declaration
protected abstract void OnDetach()
OnLoaded()
Invoked when the object is loaded.
Declaration
protected abstract void OnLoaded()
Start()
Invoked to start the object.
Declaration
protected abstract void Start()
Events
AttachableStateChanged
Event raised when the attachable object changes its state.
Declaration
public event EventHandler<AttachableObjectState> AttachableStateChanged
Event Type
Type | Description |
---|---|
EventHandler<AttachableObjectState> |