feat: added sound events for enemy awareness
This commit is contained in:
parent
1373656f90
commit
66aede32bd
15 changed files with 234 additions and 16 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "health_status.h"
|
||||
#include "hitbox.h"
|
||||
#include "macros.h"
|
||||
#include "muzzle_effect.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
void HitscanMuzzle::_bind_methods() {
|
||||
|
|
@ -9,6 +10,7 @@ void HitscanMuzzle::_bind_methods() {
|
|||
BIND_PROPERTY(Variant::FLOAT, spread);
|
||||
BIND_PROPERTY(Variant::INT, damage);
|
||||
BIND_PROPERTY(Variant::INT, ray_count);
|
||||
BIND_HPROPERTY(Variant::OBJECT, muzzle_effect, PROPERTY_HINT_NODE_TYPE, "MuzzleEffect");
|
||||
}
|
||||
|
||||
void HitscanMuzzle::instantiate_impact_effect() {
|
||||
|
|
@ -45,6 +47,7 @@ void HitscanMuzzle::ready() {
|
|||
} else {
|
||||
print_error("HitscanMuzzle::ready: impact effect is invalid");
|
||||
}
|
||||
|
||||
set_enabled(false);
|
||||
}
|
||||
|
||||
|
|
@ -62,6 +65,9 @@ void HitscanMuzzle::_notification(int what) {
|
|||
}
|
||||
|
||||
void HitscanMuzzle::shoot() {
|
||||
if (this->muzzle_effect != nullptr) {
|
||||
this->muzzle_effect->GDVIRTUAL_CALL(trigger);
|
||||
}
|
||||
for (int i{ this->ray_count }; i > 0; --i) {
|
||||
set_transform(this->home_transform);
|
||||
rotate_object_local(Vector3(0.f, 1.f, 0.f), Math::random(-Math::PI, Math::PI));
|
||||
|
|
@ -95,3 +101,11 @@ void HitscanMuzzle::set_ray_count(int amount) {
|
|||
int HitscanMuzzle::get_ray_count() const {
|
||||
return this->ray_count;
|
||||
}
|
||||
|
||||
void HitscanMuzzle::set_muzzle_effect(MuzzleEffect *effect) {
|
||||
this->muzzle_effect = effect;
|
||||
}
|
||||
|
||||
MuzzleEffect *HitscanMuzzle::get_muzzle_effect() const {
|
||||
return this->muzzle_effect;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue