#ifndef DAMAGE_AREA_HPP
#define DAMAGE_AREA_HPP

#include "enemy_car.hpp"
#include "godot_cpp/classes/animation_player.hpp"
#include <godot_cpp/classes/area3d.hpp>
#include <godot_cpp/templates/vector.hpp>

namespace godot {
//! Collision area that damages nodes of the given types when entered.
class DamageArea : public Area3D {
    GDCLASS(DamageArea, Area3D);
    //! Bind editor properties.
    static void _bind_methods();
public:
    //! Register body_entered observer. Get animation player if applicable. Get parent if applicable.
    virtual void _enter_tree() override;
    //! Animate until end, destroy if animation has ended.
    virtual void _process(double delta_time) override;
protected:
    //! If the node is of a class referenced in target_classes, deal damage.
    void body_entered(Node3D *node);
    //! Node classes to deal damage to.
    void set_target_classes(Array array);
    //! Node classes to deal damage to.
    Array get_target_classes() const;
private:
    Vector<StringName> target_classes{};
    AnimationPlayer *anim{nullptr};
};
}

#endif // !DAMAGE_AREA_HPP
