2024-10-25 15:41:39 +08:00
|
|
|
extends Unit
|
|
|
|
#除了玩家外的单位
|
|
|
|
class_name UnitOther
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_sense_area_body_entered(body: Node2D) -> void:
|
|
|
|
if body is Unit:
|
|
|
|
#自动初始化好感度
|
2024-10-28 19:24:10 +08:00
|
|
|
Global.get_unit_favour(get_unit_id(),body.get_unit_id())
|
2024-10-25 15:41:39 +08:00
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
super._ready()
|
|
|
|
%hp.max_value=unit_data["hp_max"]
|
|
|
|
%hp.value=unit_data["hp"]
|
|
|
|
|
|
|
|
|
|
|
|
func _on_state_value_changed(state_value_name: String, value: Variant) -> void:
|
|
|
|
match state_value_name:
|
|
|
|
"hungry":
|
|
|
|
%hungry.text="饥饿值:"+str(value)
|
|
|
|
"hp":
|
|
|
|
%hp.value=value
|
|
|
|
"hp_max":
|
|
|
|
%hp.max_value=value
|
|
|
|
pass # Replace with function body.
|