Add Hitmarkers

This commit is contained in:
Morph01
2024-08-30 18:09:55 +02:00
parent 67f7335dba
commit 32f8f2fcde
8 changed files with 136 additions and 3 deletions

View File

@@ -35,6 +35,9 @@ void BoneCollisionShape::_ready() {
m_Crosshair = Object::cast_to<Crosshair>(
get_parent()->get_parent()->get_parent()->get_parent()->get_parent()->get_parent()->get_parent()->find_child("Crosshair"));
DEV_ASSERT(m_Crosshair);
m_HitMarkers = Object::cast_to<HitMarkers>(
get_parent()->get_parent()->get_parent()->get_parent()->get_parent()->get_parent()->get_parent()->find_child("HitMarkers"));
DEV_ASSERT(m_HitMarkers);
}
void BoneCollisionShape::set_head_damage(int a_D) {
@@ -56,12 +59,13 @@ int BoneCollisionShape::get_body_damage() const {
void BoneCollisionShape::headshot_hit() {
ERR_PRINT("zombie headshot hit");
m_Crosshair->set_dot_color(Color(1, 0, 0, 1));
m_HitMarkers->hsvisible(true);
emit_signal("a_ZombieHeadShotHit", m_HeadDamage);
}
void BoneCollisionShape::bodyshot_hit() {
ERR_PRINT("zombie body hit");
m_Crosshair->set_dot_color(Color(0, 0, 1, 1));
m_HitMarkers->visible(true);
emit_signal("a_ZombieBodyShotHit", m_BodyDamage);
}