#pragma once

#include <godot_cpp/classes/animation_player.hpp>
#include <godot_cpp/classes/camera3d.hpp>
#include <godot_cpp/classes/character_body3d.hpp>
#include <godot_cpp/classes/input_event_mouse_motion.hpp>
#include <godot_cpp/classes/node3d.hpp>
#include <godot_cpp/classes/packed_scene.hpp>
#include <godot_cpp/classes/ray_cast3d.hpp>
#include <godot_cpp/classes/ref.hpp>

namespace blitz {

class FirstPersonPlayer : public godot::CharacterBody3D {
	GDCLASS(FirstPersonPlayer, godot::CharacterBody3D)
  protected:
	static void _bind_methods();

  public:
	FirstPersonPlayer();
	~FirstPersonPlayer();

	// Godot overrides
	void _unhandled_input(const godot::Ref<godot::InputEvent>&);
	void _physics_process(float delta);
	void _ready();
	void hit(godot::Vector3 dir);

  private:
	godot::Camera3D* m_Camera;
	godot::Node3D* m_Head;
	godot::AnimationPlayer* m_WeaponAnimation;
	godot::RayCast3D* m_GunBarrel;
	godot::Node* m_BulletInstance;
	godot::Ref<godot::PackedScene> m_BulletScene;
	float m_BobTime;
	float m_Speed;

	void UpdateBobbing(float delta);
	void UpdateFOV(float delta);
	void UpdateCamera(const godot::InputEventMouseMotion&);
	void UpdatePosition(float delta);
	
};

}  // namespace blitz