|
Capycore Engine
0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
|
Component representing a navigation node in a navigation graph. More...
#include <navigation_node.h>
Public Member Functions | |
| NavigationNode () | |
| void | update (float dt) override |
| Update is left empty as navigation nodes do not require per-frame updates. | |
| NavigationNode & | add_edge (NavigationNode &neighbor, float cost) |
| Adds a neighboring node with the specified movement cost. | |
| const std::vector< Edge > & | get_edges () const |
| Retrieves the edges (connections) to neighboring nodes. | |
| std::optional< std::reference_wrapper< Edge > > | get_edge_to (const NavigationNode &neighbor) const |
| Retrieves the edge to a specific neighboring node, if it exists. | |
| GraphPosition | position () const noexcept |
| Gets the graph position of this navigation node. | |
| NavigationNode & | position (const GraphPosition &position) |
| Sets the graph position of this navigation node. | |
| std::string | type_name () const override |
| Provides a consistent type name for the component. | |
Public Member Functions inherited from Renderable | |
| Renderable () | |
| Renderable (int layer) | |
| ~Renderable () override=default | |
| Renderable & | order_in_layer (int layer) |
| int | order_in_layer () const |
| void | set_render_strategy (Component &component) |
| virtual IRenderingStrategy & | render_strategy () const |
| std::string | type_name () const override |
| Provides a consistent type name for the component. | |
| Renderable & | disable_draw () noexcept |
| Renderable & | enable_draw () noexcept |
| bool | should_draw () const noexcept |
Public Member Functions inherited from Component | |
| Component () | |
| virtual | ~Component ()=default |
| bool | active () const noexcept |
| Checks if the component is active. | |
| Component & | active (bool value) noexcept |
| bool | marked_for_deletion () const noexcept |
| Activates the component. | |
| Component & | mark_for_deletion () noexcept |
| virtual void | on_attach () |
| Called when the component is attached to a GameObject. | |
| virtual void | on_detach () |
| Called when the component is detached from a GameObject. | |
| virtual void | on_serialize (std::vector< uint8_t > &) const |
| Serializes the component's state into a byte array. | |
| virtual void | on_deserialize (const std::vector< uint8_t > &, size_t &) |
| Deserializes the component's state from a byte array. | |
| const std::optional< std::reference_wrapper< GameObject > > & | parent () const noexcept |
| Gets the parent GameObject of this component. | |
| std::optional< std::reference_wrapper< GameObject > > & | parent () noexcept |
| Gets the parent GameObject of this component. | |
| Component & | parent (GameObject &parent) |
| Component & | parent (std::nullopt_t nullopt) |
| size_t | add_on_attach (const std::function< void(Component &)> &action) |
| Retrieves the type information of the component. | |
| void | remove_on_attach (size_t index) |
| size_t | add_on_detach (const std::function< void(Component &)> &action) |
| Adds an action to be performed when the component is attached. | |
| void | remove_on_detach (size_t index) |
Additional Inherited Members | |
Protected Attributes inherited from Renderable | |
| std::unique_ptr< IRenderingStrategy > | render_strategy_ |
| int | ordering_layer_ = 0 |
| bool | draw {true} |
Component representing a navigation node in a navigation graph.
This component holds references to neighboring nodes and associated movement costs. It is used in AI pathfinding to navigate through a graph of nodes.
Usage:
| NavigationNode::NavigationNode | ( | ) |
| NavigationNode & NavigationNode::add_edge | ( | NavigationNode & | neighbor, |
| float | cost | ||
| ) |
Adds a neighboring node with the specified movement cost.
| neighbor | Reference to the neighboring NavigationNode. |
| cost | The cost associated with moving to the neighbor. |
| std::optional< std::reference_wrapper< Edge > > NavigationNode::get_edge_to | ( | const NavigationNode & | neighbor | ) | const |
Retrieves the edge to a specific neighboring node, if it exists.
| neighbor | Reference to the neighboring NavigationNode. |
| const std::vector< Edge > & NavigationNode::get_edges | ( | ) | const |
Retrieves the edges (connections) to neighboring nodes.
|
noexcept |
Gets the graph position of this navigation node.
| NavigationNode & NavigationNode::position | ( | const GraphPosition & | position | ) |
Sets the graph position of this navigation node.
| position | The GraphPosition to set. |
|
overridevirtual |
Provides a consistent type name for the component.
Implements Component.
|
inlineoverridevirtual |
Update is left empty as navigation nodes do not require per-frame updates.
Implements Component.