Ctrl+K

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 the Entity that owns this component.

Entity Owner { get }

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 }

Keyboard

Gets the Keyboard instance of GameContext.InputManager

IKeyboard Keyboard { get }

PointingDevice

Gets the PointingDevice instance of GameContext.InputManager

IPointingDevice PointingDevice { get }

Enabled

Gets whether or not this component is currently enabled.

bool Enabled { get }

AssetManager

Gets the asset manager object of the current scene. Returns null if the entity is not part of any scene.

AssetManager AssetManager { get }

PauseState

Gets or sets the pause state flags for this component.

PauseStateFlags PauseState { get set }

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. This is also called on the new component for every existing component in the 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()

Enable

Disables the component.

void Enable()

Disable

Enables the component.

void Disable()