feat: enemy death and damage effects
This commit is contained in:
parent
2134fcae92
commit
1a8c64806d
13 changed files with 96 additions and 7 deletions
|
|
@ -14,9 +14,13 @@ void HitscanMuzzle::instantiate_impact_effect() {
|
|||
if (get_collider() == nullptr) {
|
||||
return;
|
||||
}
|
||||
Node *effect_as_node{ this->impact_effect->instantiate() };
|
||||
Ref<PackedScene> effect_scene{ get_collider()->call("get_impact_effect") };
|
||||
if (!effect_scene.is_valid()) {
|
||||
effect_scene = this->impact_effect;
|
||||
}
|
||||
Node *effect_as_node{ effect_scene->instantiate() };
|
||||
if (Node3D * effect{ cast_to<Node3D>(effect_as_node) }) {
|
||||
get_tree()->get_current_scene()->add_child(effect);
|
||||
cast_to<Node>(get_collider())->add_child(effect);
|
||||
Vector3 const point{ get_collision_point() };
|
||||
Vector3 const normal{ get_collision_normal() };
|
||||
Vector3 const position{ get_global_position() };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue