feat: added more settings to rifle
This commit is contained in:
parent
58e90780d5
commit
f02dbf44ac
|
@ -1,10 +1,16 @@
|
||||||
#include "rifle.h"
|
#include "rifle.h"
|
||||||
#include "scene/animation/animation_player.h"
|
#include "scene/animation/animation_player.h"
|
||||||
#include "wave_survival/hitscan_muzzle.h"
|
#include "wave_survival/hitscan_muzzle.h"
|
||||||
|
#include "wave_survival/macros.h"
|
||||||
#include "wave_survival/player_body.h"
|
#include "wave_survival/player_body.h"
|
||||||
#include "wave_survival/player_input.h"
|
#include "wave_survival/player_input.h"
|
||||||
|
|
||||||
void Rifle::_bind_methods() {}
|
void Rifle::_bind_methods() {
|
||||||
|
BIND_PROPERTY(Variant::FLOAT, ads_factor);
|
||||||
|
BIND_PROPERTY(Variant::FLOAT, run_factor);
|
||||||
|
BIND_PROPERTY(Variant::FLOAT, recoil_force);
|
||||||
|
BIND_PROPERTY(Variant::FLOAT, recoil_time);
|
||||||
|
}
|
||||||
|
|
||||||
void Rifle::queue_start_aim() {
|
void Rifle::queue_start_aim() {
|
||||||
get_anim()->queue("hip_to_aim");
|
get_anim()->queue("hip_to_aim");
|
||||||
|
@ -71,10 +77,6 @@ void Rifle::on_animation_changed(String new_animation) {
|
||||||
} else if (new_animation == "run") {
|
} else if (new_animation == "run") {
|
||||||
get_camera()->set_fov_factor(this->run_factor);
|
get_camera()->set_fov_factor(this->run_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_line(vformat("playing %s", new_animation));
|
|
||||||
Vector<String> queue{ get_anim()->get_queue() };
|
|
||||||
print_line(queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rifle::ready() {
|
void Rifle::ready() {
|
||||||
|
@ -169,3 +171,19 @@ void Rifle::set_run_factor(float value) {
|
||||||
float Rifle::get_run_factor() const {
|
float Rifle::get_run_factor() const {
|
||||||
return this->run_factor;
|
return this->run_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Rifle::set_recoil_force(float value) {
|
||||||
|
this->recoil_force = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Rifle::get_recoil_force() const {
|
||||||
|
return this->recoil_force;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rifle::set_recoil_time(float value) {
|
||||||
|
this->recoil_time = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Rifle::get_recoil_time() const {
|
||||||
|
return this->recoil_time;
|
||||||
|
}
|
||||||
|
|
|
@ -30,12 +30,14 @@ public:
|
||||||
virtual void notify_selected() override;
|
virtual void notify_selected() override;
|
||||||
bool is_animating() const;
|
bool is_animating() const;
|
||||||
|
|
||||||
void set_recoil_radians(float value);
|
|
||||||
float get_recoil_radians() const;
|
|
||||||
void set_ads_factor(float value);
|
void set_ads_factor(float value);
|
||||||
float get_ads_factor() const;
|
float get_ads_factor() const;
|
||||||
void set_run_factor(float value);
|
void set_run_factor(float value);
|
||||||
float get_run_factor() const;
|
float get_run_factor() const;
|
||||||
|
void set_recoil_force(float value);
|
||||||
|
float get_recoil_force() const;
|
||||||
|
void set_recoil_time(float value);
|
||||||
|
float get_recoil_time() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float ads_factor{ 0.5f };
|
float ads_factor{ 0.5f };
|
||||||
|
|
Loading…
Reference in a new issue