feat: removed reticle from HUD
This commit is contained in:
parent
5277ac6281
commit
2c95d2e7aa
|
@ -4,14 +4,10 @@ HeadsUpDisplay *HeadsUpDisplay::singleton_instance{ nullptr };
|
|||
|
||||
void HeadsUpDisplay::_bind_methods() {
|
||||
ClassDB::bind_static_method("HeadsUpDisplay", D_METHOD("get_singleton"), &self_type::get_singleton);
|
||||
ClassDB::bind_method(D_METHOD("set_tooltip"), &self_type::set_tooltip);
|
||||
}
|
||||
|
||||
void HeadsUpDisplay::on_child_entered(Node *child) {
|
||||
child->connect("child_entered_tree", callable_mp(this, &self_type::on_child_entered));
|
||||
if (child->is_unique_name_in_owner() && child->get_name() == "Reticle") {
|
||||
this->reticle = cast_to<Control>(child);
|
||||
}
|
||||
if (child->is_unique_name_in_owner() && child->get_name() == "Tooltip") {
|
||||
this->tooltip = cast_to<Label>(child);
|
||||
}
|
||||
|
@ -46,12 +42,6 @@ HeadsUpDisplay *HeadsUpDisplay::get_singleton() {
|
|||
return singleton_instance;
|
||||
}
|
||||
|
||||
void HeadsUpDisplay::set_reticle_visibility(bool visible) {
|
||||
if (this->reticle) {
|
||||
this->reticle->set_visible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
void HeadsUpDisplay::set_tooltip(String const &tooltip) {
|
||||
this->tooltip->set_text(tooltip);
|
||||
}
|
||||
|
|
|
@ -17,11 +17,9 @@ protected:
|
|||
|
||||
public:
|
||||
static HeadsUpDisplay *get_singleton();
|
||||
void set_reticle_visibility(bool visible);
|
||||
void set_tooltip(String const &tooltip);
|
||||
|
||||
private:
|
||||
Control *reticle{ nullptr };
|
||||
Label *tooltip{ nullptr };
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "rifle.h"
|
||||
#include "scene/animation/animation_player.h"
|
||||
#include "wave_survival/heads_up_display.h"
|
||||
#include "wave_survival/hitscan_muzzle.h"
|
||||
#include "wave_survival/macros.h"
|
||||
#include "wave_survival/player_body.h"
|
||||
|
@ -88,14 +87,9 @@ void Rifle::on_animation_changed(String new_animation) {
|
|||
if (new_animation == "aim") {
|
||||
this->in_alt_mode = true;
|
||||
this->fov = this->ads_factor;
|
||||
HeadsUpDisplay::get_singleton()->set_reticle_visibility(false);
|
||||
} else if (new_animation == "hip") {
|
||||
this->in_alt_mode = false;
|
||||
this->fov = 1.0;
|
||||
HeadsUpDisplay::get_singleton()->set_reticle_visibility(true);
|
||||
}
|
||||
if (new_animation == "reload") {
|
||||
HeadsUpDisplay::get_singleton()->set_reticle_visibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,9 +176,6 @@ void Rifle::notify_deselected() {
|
|||
get_input()->disconnect(PlayerInput::sig_alt_mode, callable_mp(this, &self_type::on_alt_mode));
|
||||
get_input()->disconnect(PlayerInput::sig_reload, callable_mp(this, &self_type::on_reload));
|
||||
this->running = false;
|
||||
if (HeadsUpDisplay * hud{ HeadsUpDisplay::get_singleton() }) {
|
||||
hud->set_reticle_visibility(true);
|
||||
}
|
||||
this->in_alt_mode = false;
|
||||
this->fov = 1.f;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue