simple dynamic crosshair

This commit is contained in:
Morph01
2024-08-25 18:25:22 +02:00
parent 5c6f82c5d7
commit 68d3cec08a
8 changed files with 152 additions and 5 deletions

View File

@@ -24,7 +24,10 @@ BoneCollisionShape::BoneCollisionShape() {}
BoneCollisionShape::~BoneCollisionShape() {}
void BoneCollisionShape::_ready() {}
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);
}
void BoneCollisionShape::set_head_damage(int a_D) {
m_HeadDamage = a_D;
@@ -44,11 +47,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));
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));
emit_signal("a_ZombieBodyShotHit", m_BodyDamage);
}