mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-11 22:44:45 +00:00
Add Unit Tests for HealthComponent
This commit is contained in:
parent
c9d4a50412
commit
aa2bbfda19
3 changed files with 64 additions and 11 deletions
|
|
@ -21,19 +21,19 @@ class_name HealthComponent extends Area3D
|
|||
health_changed.emit(value)
|
||||
|
||||
signal health_zeroed
|
||||
signal health_changed(value : int)
|
||||
signal health_changed(value : float)
|
||||
|
||||
func _ready() -> void:
|
||||
heal_full()
|
||||
|
||||
@rpc("call_local")
|
||||
func damage(amount : int) -> void:
|
||||
func damage(amount : float) -> void:
|
||||
health = clampf(health - amount, 0.0, max_health)
|
||||
if health == 0.0:
|
||||
health_zeroed.emit()
|
||||
|
||||
@rpc("call_local")
|
||||
func _heal(amount : int) -> void:
|
||||
func _heal(amount : float) -> void:
|
||||
health = clampf(health + amount, 0.0, max_health)
|
||||
|
||||
func heal_full() -> void:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue