tunnel-strategy/src/projectile_pool.hpp

30 lines
710 B
C++

#ifndef PROJECTILE_POOL_HPP
#define PROJECTILE_POOL_HPP
#include "weapon_data.hpp"
#include <godot_cpp/classes/node3d.hpp>
#include <godot_cpp/templates/vector.hpp>
namespace godot {
class ProjectilePool : public Node {
GDCLASS(ProjectilePool, Node);
static void _bind_methods();
public:
virtual void _exit_tree() override;
void set_data(Ref<WeaponData> data);
Ref<WeaponData> get_data() const;
Node3D *claim_projectile();
void return_projectile(Node3D *node);
protected:
Node3D *instantiate_new(bool active = false);
private:
Ref<WeaponData> data{};
size_t count{0};
Vector<Node3D*> active{};
Vector<Node3D*> inactive{};
};
}
#endif // !PROJECTILE_POOL_HPP