47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef PLAYER_BODY_H
 | 
						|
#define PLAYER_BODY_H
 | 
						|
 | 
						|
#include "scene/3d/physics/character_body_3d.h"
 | 
						|
class WeaponInventory;
 | 
						|
class HealthStatus;
 | 
						|
class PlayerCamera;
 | 
						|
 | 
						|
class PlayerBody : public CharacterBody3D {
 | 
						|
	GDCLASS(PlayerBody, CharacterBody3D);
 | 
						|
	static void _bind_methods();
 | 
						|
	static PlayerBody *singleton_instance;
 | 
						|
 | 
						|
	void on_child_entered(Node *node);
 | 
						|
	void process(double delta);
 | 
						|
	void physics_process(double delta);
 | 
						|
 | 
						|
	void set_movement_input(Vector2 state);
 | 
						|
	void on_jump_input();
 | 
						|
	void on_run_input(bool run);
 | 
						|
 | 
						|
protected:
 | 
						|
	void _notification(int what);
 | 
						|
	virtual PackedStringArray get_configuration_warnings() const override;
 | 
						|
 | 
						|
public:
 | 
						|
	static PlayerBody *get_singleton();
 | 
						|
	bool get_is_running() const;
 | 
						|
	bool get_wants_to_run() const;
 | 
						|
	HealthStatus *get_health() const;
 | 
						|
 | 
						|
private:
 | 
						|
	bool try_running{ false };
 | 
						|
	float walk_speed{ 4.f };
 | 
						|
	float run_speed{ 6.f };
 | 
						|
	float acceleration{ 40.f };
 | 
						|
	float jump_strength{ 3.75f };
 | 
						|
	Vector2 movement_input{ 0, 0 };
 | 
						|
	float fov{ 1.f };
 | 
						|
 | 
						|
	PlayerCamera *camera{ nullptr };
 | 
						|
	WeaponInventory *weapons{ nullptr };
 | 
						|
	HealthStatus *health{ nullptr };
 | 
						|
};
 | 
						|
 | 
						|
#endif // !PLAYER_BODY_H
 |