96 std::vector<std::reference_wrapper<GameObject>>&
get_path();
108 std::vector<std::reference_wrapper<
GameObject>> path_;
109 std::optional<std::reference_wrapper<
GameObject>> pathfinding_game_object_;
110 std::optional<std::reference_wrapper<
GameObject>> chase_target_;
111 std::optional<std::reference_wrapper<
GameObject>> patrol_target_;
113 std::optional<std::reference_wrapper<
Rigidbody2D>> rigidbody_{std::nullopt};
116 bool use_graph_traversal_{
true};
119 bool returning_to_start_{
false};
121 Vector3 last_position_{0, 0, 0};
122 float stuck_timer_{0.0f};
123 float stuck_threshold_{1.0f};
125 float node_distance_threshold_{2.0f};
126 float arrival_threshold_{24.0f};
137 float height_{10.0f};
139 std::reference_wrapper<Pathfinding> get_pathfinding_component();
141 std::vector<std::function<void(
AIController&)>> on_patrol_complete_actions_;
AIControllerMode
Enumeration for AI Controller modes.
Definition ai_controller.h:17
@ PATROL
Definition ai_controller.h:18
@ CHASE
Definition ai_controller.h:19
Component responsible for controlling AI behavior.
Definition ai_controller.h:48
AIController & clear_chase_target()
AIController & set_mode(AIControllerMode mode)
void chase(float dt)
Handles chasing behavior towards the chase target.
size_t add_on_patrol_complete_action(std::function< void(AIController &)> action)
AIController & clear_patrol_target()
void remove_on_patrol_complete_action(size_t index)
AIControllerMode get_mode() const
void try_traverse_graph(Transform &source, Transform &target, float dt)
Attempts to traverse the navigation graph from source to target.
AIController & set_arrival_threshold(float threshold)
std::optional< std::reference_wrapper< GameObject > > get_chase_target() const
bool disable_graph_traversal() noexcept
std::optional< std::reference_wrapper< GameObject > > get_patrol_target() const
std::vector< std::reference_wrapper< GameObject > > & get_path()
AIController & set_height(float height)
AIController & set_width(float width)
std::string type_name() const override
Provides a consistent type name for the component.
void patrol(float dt)
Handles patrolling behavior between patrol points.
float get_arrival_threshold() const
AIController(GameObject &pathfinding_game_object)
AIController & set_patrol_target(GameObject &target)
AIController & set_chase_target(GameObject &target)
void update(float dt) override
bool enable_graph_traversal() noexcept
AIController & set_speed(float speed)
Concept to constrain types to be derived from Component.
Definition gameObject.h:33
Base class for renderable components in the engine.
Definition renderable.h:16
A 2D rigidbody component that adds physics properties to a GameObject.
Definition rigidbody_2d.h:23
Represents a 3D vector with x, y, and z components. This class provides basic vector operations such ...
Definition vector3.h:8