42 lines
874 B
C++
42 lines
874 B
C++
#ifndef PLAYER_BODY_H
|
|
#define PLAYER_BODY_H
|
|
|
|
#include "scene/3d/physics/character_body_3d.h"
|
|
class WeaponInventory;
|
|
|
|
class PlayerBody : public CharacterBody3D {
|
|
GDCLASS(PlayerBody, CharacterBody3D);
|
|
static void _bind_methods();
|
|
static PlayerBody *singleton_instance;
|
|
|
|
private:
|
|
void ready();
|
|
void process(double delta);
|
|
void physics_process(double delta);
|
|
|
|
void set_movement_input(Vector2 state);
|
|
void on_look_input(Vector2 look);
|
|
void on_jump_input();
|
|
void on_run_input(bool run);
|
|
|
|
protected:
|
|
void _notification(int what);
|
|
|
|
public:
|
|
static PlayerBody *get_singleton();
|
|
bool get_is_running() const;
|
|
bool get_wants_to_run() const;
|
|
|
|
private:
|
|
bool try_running{ false };
|
|
float walk_speed{ 6.f };
|
|
float run_speed{ 8.f };
|
|
float acceleration{ 40.f };
|
|
float jump_strength{ 3.5f };
|
|
Vector2 movement_input{};
|
|
|
|
WeaponInventory *weapons;
|
|
};
|
|
|
|
#endif // !PLAYER_BODY_H
|