Skip to main content

Component

Namespace: MonineEngine.Core

The base class of all components. Can be attached to an Component.Entity to run logic.

public abstract class Component

Inheritance ObjectComponent
Attributes NullableContextAttribute, NullableAttribute

Properties

Enabled

Gets or sets a value representing if the Component is enabled or not. Defaults to true.
When false, Update and Draw will not be called.

public bool Enabled { get; set; }

Property Value

Boolean

Entity

Gets the Entity this component is attached to.

public Entity Entity { get; internal set; }

Property Value

Entity

Parent

Basically just a shortcut of Entity.Parent.

public Entity Parent { get; }

Property Value

Entity

Transform

Gets the transform of the Component.Entity this component is attached to.

public Transform Transform { get; }

Property Value

Transform

Camera

public Camera2D Camera { get; }

Property Value

Camera2D

Constructors

Component()

Constructs a Component. Component.Initialize() is not called here, and is instead called when added to an Component.Entity.

protected Component()

Methods

Initialize()

Called when the Component is initialized, which occurs when the component gets added to an Entity.

public void Initialize()

Update(GameTime)

Called every frame.

public void Update(GameTime gameTime)

Parameters

gameTime GameTime

Draw(GameTime)

Called to submit rendering to the current sprite batch.

public void Draw(GameTime gameTime)

Parameters

gameTime GameTime
A snapshot of the timing values for the current frame.

OnEnabled()

A method called when this Component becomes enabled.

protected void OnEnabled()

OnDisabled()

A method called when this Component becomes disabled.

protected void OnDisabled()