alai/src/player/AI.h

116 lines
3.2 KiB
C
Raw Normal View History

2023-02-26 21:45:25 -03:00
#ifndef ALAI_PLAYER_AI_H
#define ALAI_PLAYER_AI_H
#include "Event.h"
#include "obelisk.h"
#include "player/Player.h"
#include <Godot.hpp>
#include <Input.hpp>
#include <Node.hpp>
2023-03-01 09:19:25 -03:00
#include <Timer.hpp>
2023-02-26 21:45:25 -03:00
#include <Vector2.hpp>
#include <queue>
namespace alai
{
namespace player
{
class Entity
{
public:
2023-03-01 09:19:25 -03:00
godot::String originalName;
2023-02-26 21:45:25 -03:00
godot::String name;
godot::String state;
godot::Vector2 position;
godot::Vector2 velocity;
};
class AI : public godot::Node
{
GODOT_CLASS(AI, godot::Node)
private:
/**
* @brief Input singleton.
*
*/
godot::Input* _input;
/**
* @brief The obelisk object.
*
*/
std::unique_ptr<obelisk::Obelisk> obelisk;
alai::Event* event;
2023-03-01 09:19:25 -03:00
std::deque<alai::player::Entity> entities;
2023-02-26 21:45:25 -03:00
alai::player::Player* parent;
2023-03-01 09:19:25 -03:00
godot::String lastEntity;
godot::Timer* timer = godot::Timer()._new();
2023-02-26 21:45:25 -03:00
public:
/**
* @brief This method registers classes with Godot.
*
* @details This method registers methods, properties, and signals with the Godot engine.
*/
static void
_register_methods();
2023-03-01 09:19:25 -03:00
/**
* @brief Construct a new AI object.
*
*/
2023-02-26 21:45:25 -03:00
AI();
2023-03-01 09:19:25 -03:00
/**
* @brief Destroy the AI object.
*
*/
2023-02-26 21:45:25 -03:00
~AI();
/**
* @brief Initialize the class from Godot.
*
* @details This method is called just once when the Godot engine connects to the instance of the class.
*/
void _init();
/**
* @brief Code to be run when ready.
*
* @details This method is run when all the children of this node are ready.
*/
void _ready();
/**
* @brief The physics processed every delta time.
*
* @param[in] delta The time since the method was last run.
*/
void _physics_process(float delta);
2023-03-01 09:19:25 -03:00
void _on_timer_timeout();
void unset_action(godot::String action);
/**
* @brief Callback that receives information about the game environment.
*
* @param[in] name The name of the object.
* @param[in] state The state the object is in.
* @param[in] position The position of the object.
* @param[in] velocity The object's velocity.
*/
2023-02-26 21:45:25 -03:00
void _on_object_report(godot::String name, godot::String state, godot::Vector2 position, godot::Vector2 velocity);
};
} // namespace player
} // namespace alai
#endif