Objects::ObjectComponent

ObjectComponent in Unified Engine

The ObjectComponent class acts as a foundational unit within the Unified Engine. It represents an individual entity or component in the engine. Each ObjectComponent can have both child components and child entities, creating a tree-like structure, which aids in representing hierarchical structures like game objects with their components or parent-child relationships in game scenes.

Class Components

Enum:

  • ObjectComponentType: Defines the different types of objects and components that the engine can handle, including game objects, shader objects, cameras, etc.

Protected Members:

  • Parent: Points to the parent ObjectComponent of the current object.

  • Children: A list of child ObjectComponent entities attached to this object.

  • Components: A list of child ObjectComponent components attached to this object.

  • Enabled: A boolean flag indicating whether the component is active or not.

  • Main: Generic pointer for internal use.

Public Members:

  • type: Stores the type of the component (from the ObjectComponentType enum).

Constructors & Destructor:

  • ObjectComponent(ObjectComponent* _Parent, ObjectComponentType Type, bool Component = false): Constructs an ObjectComponent with a specified parent, type, and optional component flag.

  • ~ObjectComponent(): Destructor for the ObjectComponent.

Methods:

  • UpdateC(): Updates the child components of the object.

  • Update(): Virtual method to update the state of the ObjectComponent. Intended for overriding.

  • RenderC(): Renders the child components of the object.

  • Render(): Virtual method to render the ObjectComponent to the screen. Intended for overriding.

  • GetCompoentOfType(ObjectComponentType type): Returns the first component of the specified type attached to the object.

  • GetCompoentsOfType(ObjectComponentType type): Returns all components of the specified type attached to the object.

  • GetChildOfType(ObjectComponentType type): Returns the first child of the specified type attached to the object.

  • GetChildrenOfType(ObjectComponentType type): Returns all children of the specified type attached to the object.

Last updated