feat: commenting an cleanup pass character_actor.hpp

This commit is contained in:
Sara 2024-03-31 18:17:29 +02:00
parent dc56c7bc52
commit 540d91ddcf

View file

@ -3,6 +3,7 @@
#include "character_data.hpp"
#include "health.hpp"
#include "state.hpp"
#include "projectile_pool.hpp"
#include <godot_cpp/classes/character_body3d.hpp>
#include <godot_cpp/classes/curve.hpp>
@ -19,11 +20,19 @@ public:
virtual void _enter_tree() override;
virtual void _process(double delta_time) override;
virtual void _physics_process(double delta_time) override;
// manually set target_velocity
void move(Vector3 world_vector);
// manually aim at a target position
// calls aim_direction with the flattened direction to 'at'
void aim(Vector3 at);
// manually set the forward vector of target_rotation
void aim_direction(Vector3 direction);
// set a movement target to navigate towards
void move_to(Vector3 to, float target_distance = 0.5f);
// fire weapon at a target position
// calls aim(at) and set_firing(true)
void shoot_at(Vector3 at);
// getter-setters
void set_firing(bool firing);
void set_manual_mode(bool value);
@ -44,19 +53,31 @@ protected:
void process_rotation(double delta_time);
void try_fire_weapon();
private:
// desired velocity, accelerated towards each frame
Vector3 velocity_target{0.f,0.f,0.f};
// target rotation, slerped towards each frame
Basis target_rotation{};
NavigationAgent3D *nav_agent{nullptr};
// ignore any ai planning or navigation
bool mode_manual{false};
// fire weapon at whatever we're aiming at
bool firing{false};
// the next timestamp at which a weapon can be fired
float fire_timer{0.f};
// the origin point for projectiles
Node3D *weapon_muzzle{nullptr};
// whatever the AI is currently targetting
Node *target{nullptr};
// the current state of the actor
goap::State current_state{}; // the current state
Health *health{nullptr};
ProjectilePool *primary_weapon_pool{nullptr};
Ref<CharacterData> data;
float fire_interval{0.f};
bool firing{false};
float fire_timer{0.f};
Node3D *weapon_muzzle{nullptr};
NavigationAgent3D *nav_agent{nullptr};
Ref<Curve> rotation_speed_curve{};
// character data assigned when spawned
Ref<CharacterData> data;
float fire_interval{0.f}; // derived from the current weapon's rpm
static float const ACCELERATION;
static float const WALK_SPEED;