#ifndef PLAYER_CHARACTER_HPP #define PLAYER_CHARACTER_HPP #include "character_data.hpp" #include "health.hpp" #include "projectile_pool.hpp" #include #include namespace godot { class NavigationAgent3D; class StateMachine; class TunnelsPlayer; class PlayerCharacter : public CharacterBody3D, public IHealthEntity { GDCLASS(PlayerCharacter, CharacterBody3D); static void _bind_methods(); public: virtual void _enter_tree() override; virtual void _process(double delta_time) override; virtual void _physics_process(double delta_time) override; void move(Vector3 world_vector); void aim(Vector3 at); void aim_direction(Vector3 direction); void move_to(Vector3 to, float target_distance = 0.5f); void shoot_at(Vector3 at); void set_firing(bool firing); void set_manual_mode(bool value); void set_rotation_speed_curve(Ref curve); Ref get_rotation_speed_curve() const; virtual Health *get_health() override; virtual Health const *get_health() const override; void set_character_data(Ref data); void set_weapon_muzzle(Node3D *node); void set_velocity_target(Vector3 value); Vector3 get_velocity_target() const; protected: void process_ai(double delta_time); void process_rotation(double delta_time); void try_fire_weapon(); private: Vector3 velocity_target{0.f,0.f,0.f}; StateMachine *state_machine{nullptr}; Basis target_rotation{}; NavigationAgent3D *nav_agent{nullptr}; bool mode_manual{false}; Health *health{nullptr}; ProjectilePool *primary_weapon_pool{nullptr}; Ref data; float fire_interval{0.f}; bool firing{false}; float fire_timer{0.f}; Node3D *weapon_muzzle{nullptr}; Ref rotation_speed_curve{}; static float const ACCELERATION; static float const WALK_SPEED; static float const SPRINT_SPEED; static float const ROTATION_SPEED; }; } #endif // !PLAYER_CHARACTER_HPP