Fixed weapon damage_dealt signal not being connected to HUD for hitmarkers
parent
05b18a1b96
commit
79e566b00d
|
@ -7,9 +7,11 @@ func updateHealth(health: int):
|
|||
$Health/HealthBar.value = health
|
||||
$Health/HealthBar/HealthText.text = String(health)
|
||||
|
||||
func update_crosshair(visible: bool, hit: bool, kill: bool):
|
||||
$Crosshair.visible = visible
|
||||
if hit:
|
||||
$Crosshair/HitConfirmation.activate(0.15, false)
|
||||
elif kill:
|
||||
$Crosshair/HitConfirmation.activate(0.3, true)
|
||||
func update_crosshair(kill):
|
||||
$Crosshair.visible = true # visible
|
||||
$Crosshair/HitConfirmation.activate(0.15, false)
|
||||
|
||||
#if hit:
|
||||
# $Crosshair/HitConfirmation.activate(0.15, false)
|
||||
#elif kill:
|
||||
# $Crosshair/HitConfirmation.activate(0.3, true)
|
||||
|
|
|
@ -408,6 +408,9 @@ func set_local_player():
|
|||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$HUD/Health/HealthBar.max_value = max_health
|
||||
|
||||
for weapon in $Camera/Hand/Weapons.get_children():
|
||||
weapon.connect("damage_dealt", $HUD, "update_crosshair")
|
||||
|
||||
# Set player class
|
||||
var path = get_script().get_path()
|
||||
|
|
|
@ -221,7 +221,7 @@ script = ExtResource( 8 )
|
|||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.53592, -0.0651628 )
|
||||
|
||||
[node name="Hand" type="Spatial" parent="Camera"]
|
||||
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335, -0.391038, -0.559 )
|
||||
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335, -0.394248, -0.559 )
|
||||
|
||||
[node name="WeaponBobAnimationTree" type="AnimationTree" parent="Camera/Hand"]
|
||||
tree_root = SubResource( 12 )
|
||||
|
|
|
@ -68,7 +68,8 @@ func shoot(camera):
|
|||
if hit is Player:
|
||||
var kill = hit.health <= 0
|
||||
emit_signal("damage_dealt", kill)
|
||||
print(player.get_network_master())
|
||||
print(get_signal_connection_list("damage_dealt")[0]["target"].name)
|
||||
|
||||
else:
|
||||
reload()
|
||||
|
||||
|
|
Reference in New Issue