Class Behavior
Represents a Component that contains only logic, updatable through the Update()
method.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework
Assembly: Evergine.Framework.dll
Syntax
public abstract class Behavior : Component, IDependencyObject
Constructors
Behavior()
Initializes a new instance of the Behavior class.
Declaration
protected Behavior()
Behavior(FamilyType)
Initializes a new instance of the Behavior class.
Declaration
protected Behavior(FamilyType family)
Parameters
Type | Name | Description |
---|---|---|
FamilyType | family | The family. |
Properties
Family
Gets or sets the FamilyType.
Every behavior is initialized with Family
set to Default
.
Default behaviors are updated first, and any other behaviors with different FamilyType values
are updated subsequently.
Families that are not Default
are updated in parallel
(the list of Behavior of each FamilyType is updated in a non-deterministic sequential order).
For example, if a game had three behaviors marked as "AI" and two marked as "Physics",
it would launch two threads: one to update the AI behaviors and another to update the Physics ones.
See FamilyType for more information.
Declaration
public FamilyType Family { get; protected set; }
Property Value
Type | Description |
---|---|
FamilyType |
UpdateOrder
Gets or sets the update order. Behaviors are sorted according to this value in ascending order, so behaviors with lower values are updated before behaviors with higher values.
Declaration
[RenderProperty(Tooltip = "Behaviors are sorted according to this value in ascending order, so behaviors with lower values will be updated before behaviors with higher values")]
public float UpdateOrder { get; set; }
Property Value
Type | Description |
---|---|
float | The update order. |
Methods
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
OnDetach()
Invoked when the object is detached.
Declaration
protected override void OnDetach()
Overrides
Update(TimeSpan)
Allows this instance to execute custom logic during its Update
.
Declaration
protected abstract void Update(TimeSpan gameTime)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | gameTime | The game time. |