entity_spell_system/infos/aura_infos.cpp

103 lines
2.5 KiB
C++
Raw Normal View History

2019-04-20 14:02:55 +02:00
#include "aura_infos.h"
#include "../data/aura.h"
Entity *AuraApplyInfo::get_caster() const {
return _caster;
2019-04-20 14:02:55 +02:00
}
void AuraApplyInfo::set_caster(Entity *value) {
_caster = value;
}
void AuraApplyInfo::set_caster_bind(Node *caster) {
if (!caster) {
return;
}
2019-04-20 14:02:55 +02:00
Entity *e = Object::cast_to<Entity>(caster);
2019-04-20 14:02:55 +02:00
if (!e) {
return;
}
2019-04-20 14:02:55 +02:00
_caster = e;
2019-04-20 14:02:55 +02:00
}
Entity *AuraApplyInfo::get_target() const {
return _target;
2019-04-20 14:02:55 +02:00
}
void AuraApplyInfo::set_target(Entity *value) {
_target = value;
}
void AuraApplyInfo::set_target_bind(Node *caster) {
if (!caster) {
return;
}
2019-04-20 14:02:55 +02:00
Entity *e = Object::cast_to<Entity>(caster);
2019-04-20 14:02:55 +02:00
if (!e) {
return;
}
2019-04-20 14:02:55 +02:00
_target = e;
2019-04-20 14:02:55 +02:00
}
float AuraApplyInfo::get_spell_scale() const {
return _spell_scale;
2019-04-20 14:02:55 +02:00
}
void AuraApplyInfo::set_spell_scale(float value) {
_spell_scale = value;
2019-04-20 14:02:55 +02:00
}
Ref<Aura> AuraApplyInfo::get_aura() const {
return Ref<Aura>(_aura);
2019-04-20 14:02:55 +02:00
}
void AuraApplyInfo::set_aura(Ref<Aura> aura) {
_aura = (*aura);
2019-04-20 14:02:55 +02:00
}
AuraApplyInfo::AuraApplyInfo() {
_caster = NULL;
_target = NULL;
_spell_scale = 0;
_aura = NULL;
}
AuraApplyInfo::AuraApplyInfo(Entity *caster, Entity *target, float spell_scale, Aura *aura) {
_caster = caster;
_target = target;
_spell_scale = spell_scale;
_aura = aura;
}
AuraApplyInfo::AuraApplyInfo(Entity *caster, Entity *target, float spell_scale) {
_caster = caster;
_target = target;
_spell_scale = spell_scale;
_aura = NULL;
}
void AuraApplyInfo::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_caster"), &AuraApplyInfo::get_caster);
ClassDB::bind_method(D_METHOD("set_caster", "caster"), &AuraApplyInfo::set_caster_bind);
2019-04-20 14:02:55 +02:00
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "caster", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), "set_caster", "get_caster");
ClassDB::bind_method(D_METHOD("get_target"), &AuraApplyInfo::get_target);
ClassDB::bind_method(D_METHOD("set_target", "target"), &AuraApplyInfo::set_target_bind);
2019-04-20 14:02:55 +02:00
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "target", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), "set_target", "get_target");
ClassDB::bind_method(D_METHOD("get_spell_scale"), &AuraApplyInfo::get_spell_scale);
ClassDB::bind_method(D_METHOD("set_spell_scale", "value"), &AuraApplyInfo::set_spell_scale);
2019-04-20 14:02:55 +02:00
ADD_PROPERTY(PropertyInfo(Variant::REAL, "spell_scale"), "set_spell_scale", "get_spell_scale");
ClassDB::bind_method(D_METHOD("get_aura"), &AuraApplyInfo::get_aura);
ClassDB::bind_method(D_METHOD("set_aura", "aura"), &AuraApplyInfo::set_aura);
2019-04-20 14:02:55 +02:00
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "aura", PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "set_aura", "get_aura");
}