Renamed damage instance
This commit is contained in:
parent
d87d4c9e3f
commit
60783f7166
@ -18,11 +18,11 @@ func restore():
|
|||||||
value = max_value
|
value = max_value
|
||||||
value_changed.emit()
|
value_changed.emit()
|
||||||
|
|
||||||
func take_damage(attack: DamageInstance):
|
func take_damage(hit: Hit):
|
||||||
if !is_alive:
|
if !is_alive:
|
||||||
return
|
return
|
||||||
|
|
||||||
value = clampf(value - attack.damage, 0, max_value)
|
value = clampf(value - hit.damage, 0, max_value)
|
||||||
value_changed.emit()
|
value_changed.emit()
|
||||||
|
|
||||||
if value < DEATH_THRESHOLD:
|
if value < DEATH_THRESHOLD:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
class_name DamageInstance
|
class_name Hit
|
||||||
|
|
||||||
var damage: float
|
var damage: float
|
||||||
|
|
||||||
func _init(_damage: float):
|
func _init(_damage: float):
|
||||||
damage = _damage
|
damage = _damage
|
||||||
|
|
@ -4,4 +4,4 @@ func on_body_entered(body: Node3D):
|
|||||||
var health := body.get_node_or_null("Health") as HealthComponent
|
var health := body.get_node_or_null("Health") as HealthComponent
|
||||||
|
|
||||||
if health:
|
if health:
|
||||||
health.take_damage(DamageInstance.new(100))
|
health.take_damage(Hit.new(100))
|
Loading…
Reference in New Issue
Block a user