Class Component
Provides logic and functionality to an Entity.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework
Assembly: Evergine.Framework.dll
Syntax
public abstract class Component : PrefabInstanceObject, IDependencyObject
Remarks
A Component should 1) solve just a single problem (provide a position, render a mesh, hold a mesh, ...) and 2) depend on other Component instances to provide more complex behaviors.
For implementers
- The method
Initialize
allows you to perform custom logic when a Component is initialized. - The method
ResolveDependencies
is used to ensure the component has all the dependencies it needs to work.
Recipes and samples.
- [Component-based Architecture recipe](../recipes/Basic/Component-based-Architecture.md)
Properties
Managers
Gets the collection of scene managers.
Declaration
public SceneManagers Managers { get; }
Property Value
Type | Description |
---|---|
SceneManagers |
Owner
Gets the owner Entity of this instance. It provides a path to navigate through the entity's hierarchy.
Declaration
public Entity Owner { get; }
Property Value
Type | Description |
---|---|
Entity | The owner Entity. |
ShouldBeActivated
Gets a value indicating whether this object should be activated.
Declaration
protected override bool ShouldBeActivated { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Methods
Attach(Entity)
Attaches this component to an entity.
Declaration
public bool Attach(Entity owner)
Parameters
Type | Name | Description |
---|---|---|
Entity | owner | The entity owner. |
Returns
Type | Description |
---|---|
bool | True if the attachment is successful. |
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public virtual Component Clone()
Returns
Type | Description |
---|---|
Component | A new object that is a copy of the current instance. |
OnActivated()
Invoked when the object is activated once it is attached.
Declaration
protected override void OnActivated()
Overrides
OnAttached()
Invoked when the object is attached to the system.
Declaration
protected override bool OnAttached()
Returns
Type | Description |
---|---|
bool | True if everything is OK. |
Overrides
OnDeactivated()
Invoked when the object is deactivated.
Declaration
protected override void OnDeactivated()
Overrides
OnDestroy()
Invoked when the object is about to be disposed.
Declaration
protected override void OnDestroy()
Overrides
OnDetach()
Invoked when the object is detached.
Declaration
protected override void OnDetach()
Overrides
OnLoaded()
Invoked when the object is loaded.
Declaration
protected override void OnLoaded()
Overrides
Start()
Invoked to start the object.
Declaration
protected override void Start()