49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#include "hitbox.h"
|
|
#include "health_status.h"
|
|
#include "macros.h"
|
|
|
|
void Hitbox::_bind_methods() {
|
|
BIND_HPROPERTY(Variant::OBJECT, health, PROPERTY_HINT_NODE_TYPE, "HealthStatus");
|
|
BIND_PROPERTY(Variant::FLOAT, damage_modifier);
|
|
BIND_HPROPERTY(Variant::OBJECT, impact_effect, PROPERTY_HINT_RESOURCE_TYPE, "PackedScene");
|
|
}
|
|
|
|
void Hitbox::_notification(int what) {
|
|
if (Engine::get_singleton()->is_editor_hint()) {
|
|
return;
|
|
}
|
|
switch (what) {
|
|
default:
|
|
return;
|
|
case NOTIFICATION_READY:
|
|
if (this->impact_effect.is_valid()) {
|
|
PRELOAD_SCENE(this->impact_effect);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
|
|
void Hitbox::set_health(HealthStatus *value) {
|
|
this->health = value;
|
|
}
|
|
|
|
HealthStatus *Hitbox::get_health() const {
|
|
return this->health;
|
|
}
|
|
|
|
void Hitbox::set_damage_modifier(float value) {
|
|
this->damage_modifier = value;
|
|
}
|
|
|
|
float Hitbox::get_damage_modifier() const {
|
|
return this->damage_modifier;
|
|
}
|
|
|
|
void Hitbox::set_impact_effect(Ref<PackedScene> effect) {
|
|
this->impact_effect = effect;
|
|
}
|
|
|
|
Ref<PackedScene> Hitbox::get_impact_effect() const {
|
|
return this->impact_effect;
|
|
}
|