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 parentObjectComponentof the current object.Children: A list of childObjectComponententities attached to this object.Components: A list of childObjectComponentcomponents 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 theObjectComponentTypeenum).
Constructors & Destructor:
ObjectComponent(ObjectComponent* _Parent, ObjectComponentType Type, bool Component = false): Constructs anObjectComponentwith a specified parent, type, and optional component flag.~ObjectComponent(): Destructor for theObjectComponent.
Methods:
UpdateC(): Updates the child components of the object.Update(): Virtual method to update the state of theObjectComponent. Intended for overriding.RenderC(): Renders the child components of the object.Render(): Virtual method to render theObjectComponentto 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