BaseComponent
Declaration
public abstract class Strawberry.Core.BaseComponent
Base class for all components in the Strawberry engine. Custom components should inherit from this class to integrate with the entity-component system.
Inherits: Strawberry.ReferenceObject
Properties
Owner
Gets or sets the Entity that owns this component.
Entity Owner { get set }
Scene
Gets the Scene in which the owning entity currently resides. Returns null if the entity is not part of any scene.
Scene Scene { get }
GameContext
Gets the current IGameContext. Returns null if the entity or scene is not available.
IGameContext GameContext { get }
Methods
Initialize virtual
Called when the component is initialized. Override this method to set up the component's initial state.
void Initialize(Entity owner)
Parameters:
| Name | Type | Description |
|---|---|---|
owner |
Strawberry.Core.Entity |
The Entity that owns this component. |
OnBegin virtual
Called when the component is added to an entity.
void OnBegin()
OnEnabled virtual
Called when the component is enabled
void OnEnabled()
OnComponentAdded virtual
Called when a new component is added to the owning entity.
void OnComponentAdded(BaseComponent component)
Parameters:
| Name | Type | Description |
|---|---|---|
component |
Strawberry.Core.BaseComponent |
The newly added component. |
OnDisabled virtual
Called when the component is disabled.
void OnDisabled()
OnFinished virtual
Called when the component or its owning entity is finishing its lifecycle. Override to perform cleanup or final actions.
void OnFinished()
OnBeginUpdate virtual
Called at the beginning of the update cycle, before OnUpdate.
void OnBeginUpdate()
OnUpdate virtual
Called every frame during the main update cycle. Override to implement frame-by-frame logic.
void OnUpdate()
OnEndUpdate virtual
Called at the end of the update cycle, after OnUpdate.
void OnEndUpdate()
OnFixedUpdate virtual
Called at a fixed time interval, independent of the frame rate. Typically used for physics calculations and other time-sensitive logic.
void OnFixedUpdate()
OnRender virtual
Called during the rendering phase. Override to implement drawing or rendering logic for the component.
void OnRender()
Removed virtual
Called when the component is removed from its owner. Override to perform cleanup and release resources. Sets the Owner to null.
void Removed()