Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
navigation_node.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <unordered_map>
9#include <vector>
10
25class NavigationNode : public Renderable {
27
28 public:
30
33 void update(float dt) override{};
34
42 NavigationNode& add_edge(NavigationNode& neighbor, float cost);
43
49 const std::vector<Edge>& get_edges() const;
50
58 std::optional<std::reference_wrapper<Edge>> get_edge_to(
59 const NavigationNode& neighbor) const;
60
66 GraphPosition position() const noexcept;
67
75
76 std::string type_name() const override;
77
78 private:
79 GraphPosition position_;
80 std::vector<Edge> edges_;
81};
Component representing a navigation node in a navigation graph.
Definition navigation_node.h:25
GraphPosition position() const noexcept
Gets the graph position of this navigation node.
std::optional< std::reference_wrapper< Edge > > get_edge_to(const NavigationNode &neighbor) const
Retrieves the edge to a specific neighboring node, if it exists.
const std::vector< Edge > & get_edges() const
Retrieves the edges (connections) to neighboring nodes.
void update(float dt) override
Update is left empty as navigation nodes do not require per-frame updates.
Definition navigation_node.h:33
NavigationNode & add_edge(NavigationNode &neighbor, float cost)
Adds a neighboring node with the specified movement cost.
std::string type_name() const override
Provides a consistent type name for the component.
Base class for renderable components in the engine.
Definition renderable.h:16
Structure representing an edge in the navigation graph.
Definition graph.h:15
Structure representing a position in the navigation graph.
Definition graph.h:29