22 lines
684 B
C++
22 lines
684 B
C++
#include "character_world_state.hpp"
|
|
#include "unit.hpp"
|
|
#include "utils/godot_macros.hpp"
|
|
|
|
void CharacterWorldState::_bind_methods() {
|
|
#define CLASSNAME CharacterWorldState
|
|
}
|
|
|
|
void CharacterWorldState::_enter_tree() {
|
|
this->parent_type::_enter_tree();
|
|
this->inventory = this->get_node<Inventory>("%Inventory");
|
|
}
|
|
|
|
gd::String CharacterWorldState::get_weapon_animation() const {
|
|
return this->inventory->get_weapon()->get_animation();
|
|
}
|
|
|
|
bool CharacterWorldState::get_is_in_range() const {
|
|
float const distance{this->parent_unit->get_global_position().distance_to(this->target_node->get_global_position())};
|
|
return distance <= inventory->get_stats().weapon_range;
|
|
}
|