Compare commits
No commits in common. "8a3717eac3f1b25071c4a10d534687c44ac01594" and "48ebf76281e6111769b0dc0c77b03e02a353f9f7" have entirely different histories.
8a3717eac3
...
48ebf76281
|
@ -1,6 +1,5 @@
|
||||||
#include "revolver.h"
|
#include "revolver.h"
|
||||||
#include "scene/animation/animation_player.h"
|
#include "scene/animation/animation_player.h"
|
||||||
#include "wave_survival/player_camera.h"
|
|
||||||
#include "wave_survival/player_input.h"
|
#include "wave_survival/player_input.h"
|
||||||
|
|
||||||
void Revolver::_bind_methods() {
|
void Revolver::_bind_methods() {
|
||||||
|
@ -15,7 +14,7 @@ void Revolver::play_equip_anim() {
|
||||||
void Revolver::shoot() {
|
void Revolver::shoot() {
|
||||||
if (!is_animating()) {
|
if (!is_animating()) {
|
||||||
this->muzzle->shoot();
|
this->muzzle->shoot();
|
||||||
if (this->alt_active) {
|
if (this->alt_requested) {
|
||||||
get_anim()->queue("fire_single");
|
get_anim()->queue("fire_single");
|
||||||
get_anim()->queue("idle_single");
|
get_anim()->queue("idle_single");
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,12 +42,6 @@ void Revolver::ready() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Revolver::process(double delta) {
|
void Revolver::process(double delta) {
|
||||||
String const current{ get_anim()->get_current_animation() };
|
|
||||||
double animation_time{ get_anim()->get_current_animation_position() };
|
|
||||||
if (current == "fire_single" || current == "fire_double") {
|
|
||||||
double t{ animation_time / this->recoil_time };
|
|
||||||
get_camera()->recoil(Math::lerp((double)this->recoil_force, 0.0, CLAMP(t, 0.0, 1.0)) * delta);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Revolver::_notification(int what) {
|
void Revolver::_notification(int what) {
|
||||||
|
|
|
@ -22,9 +22,6 @@ private:
|
||||||
bool alt_requested{ false };
|
bool alt_requested{ false };
|
||||||
bool alt_active{ false };
|
bool alt_active{ false };
|
||||||
HitscanMuzzle *muzzle{ nullptr };
|
HitscanMuzzle *muzzle{ nullptr };
|
||||||
|
|
||||||
float recoil_force{ 2.f };
|
|
||||||
float recoil_time{ 0.06f };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !WEAPONS_REVOLVER_H
|
#endif // !WEAPONS_REVOLVER_H
|
||||||
|
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -20,10 +20,10 @@ bone_idx = 39
|
||||||
|
|
||||||
[node name="HitscanMuzzle" type="HitscanMuzzle" parent="revolver/Character/Skeleton3D/BoneAttachment3D"]
|
[node name="HitscanMuzzle" type="HitscanMuzzle" parent="revolver/Character/Skeleton3D/BoneAttachment3D"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
transform = Transform3D(1, 6.3507215e-17, 4.732015e-17, -6.350722e-17, 0.28601167, 0.958226, 4.7320157e-17, -0.958226, 0.28601167, -9.044954e-18, 0.04726258, 0.25400588)
|
transform = Transform3D(1, 6.3507215e-17, 4.732015e-17, -6.350722e-17, 0.28601167, 0.958226, 4.7320157e-17, -0.958226, 0.28601167, 1.0408685e-17, 0.13487417, -0.03951955)
|
||||||
target_position = Vector3(0, 200, 0)
|
target_position = Vector3(0, 200, 0)
|
||||||
collision_mask = 6
|
collision_mask = 6
|
||||||
collide_with_areas = true
|
collide_with_areas = true
|
||||||
spread = 0.02
|
spread = 0.03
|
||||||
|
|
||||||
[editable path="revolver"]
|
[editable path="revolver"]
|
||||||
|
|
Loading…
Reference in a new issue