trenches/src/artillery_target.hpp

34 lines
946 B
C++

#ifndef ARTILLERY_TARGET_HPP
#define ARTILLERY_TARGET_HPP
#include <godot_cpp/classes/node3d.hpp>
#include <godot_cpp/classes/timer.hpp>
#include <godot_cpp/classes/packed_scene.hpp>
namespace gd = godot;
class ArtilleryTarget : public gd::Node3D {
GDCLASS(ArtilleryTarget, gd::Node3D);
static void _bind_methods();
public:
virtual void _ready() override;
void set_effect(gd::Ref<gd::PackedScene> scene);
gd::Ref<gd::PackedScene> get_effect() const;
void set_spread(float value);
float get_spread() const;
void set_frequency_min(float value);
float get_frequency_min() const;
void set_frequency_max(float value);
float get_frequency_max() const;
private:
void timer_end();
void start_timer();
private:
float spread{5.f};
float frequency_min{0.5f};
float frequency_max{2.f};
gd::Ref<gd::PackedScene> effect{};
gd::Timer *timer{nullptr};
};
#endif // !ARTILLERY_TARGET_HPP