feat: projectile is no longer an interface
This commit is contained in:
parent
71de14003d
commit
cd9260871e
|
@ -3,14 +3,20 @@
|
||||||
#include <godot_cpp/classes/node3d.hpp>
|
#include <godot_cpp/classes/node3d.hpp>
|
||||||
|
|
||||||
namespace godot {
|
namespace godot {
|
||||||
void IProjectile::return_to_pool() {
|
void Projectile::_bind_methods() {
|
||||||
|
#define CLASSNAME Projectile
|
||||||
|
}
|
||||||
|
void Projectile::return_to_pool() {
|
||||||
if(!this->pool)
|
if(!this->pool)
|
||||||
return;
|
return;
|
||||||
Node3D *node = dynamic_cast<Node3D*>(this);
|
this->pool->return_projectile(this);
|
||||||
if(node)
|
|
||||||
this->pool->return_projectile(node);
|
|
||||||
}
|
}
|
||||||
void IProjectile::set_projectile_pool(ProjectilePool *pool) {
|
|
||||||
|
void Projectile::set_weapon_data(Ref<WeaponData> data) {
|
||||||
|
this->data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Projectile::set_projectile_pool(ProjectilePool *pool) {
|
||||||
this->pool = pool;
|
this->pool = pool;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,21 @@
|
||||||
#define PROJECTILE_HPP
|
#define PROJECTILE_HPP
|
||||||
|
|
||||||
#include "weapon_data.hpp"
|
#include "weapon_data.hpp"
|
||||||
|
#include <godot_cpp/classes/node3d.hpp>
|
||||||
|
|
||||||
namespace godot {
|
namespace godot {
|
||||||
class Node3D;
|
|
||||||
class ProjectilePool;
|
class ProjectilePool;
|
||||||
|
|
||||||
class IProjectile {
|
class Projectile : public Node3D {
|
||||||
|
GDCLASS(Projectile, Node3D);
|
||||||
|
static void _bind_methods();
|
||||||
public:
|
public:
|
||||||
virtual void set_weapon_data(Ref<WeaponData> data) = 0;
|
|
||||||
void return_to_pool();
|
void return_to_pool();
|
||||||
|
void set_weapon_data(Ref<WeaponData> data);
|
||||||
void set_projectile_pool(ProjectilePool *pool);
|
void set_projectile_pool(ProjectilePool *pool);
|
||||||
private:
|
protected:
|
||||||
ProjectilePool *pool{nullptr};
|
ProjectilePool *pool{nullptr};
|
||||||
|
Ref<WeaponData> data{nullptr};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue