Initial WhaleTown V2 frontend
This commit is contained in:
30
scenes/Maps/WorkZoneBuildingArea.gd
Normal file
30
scenes/Maps/WorkZoneBuildingArea.gd
Normal file
@@ -0,0 +1,30 @@
|
||||
class_name WorkZoneBuildingArea
|
||||
extends Area2D
|
||||
|
||||
# ============================================================================
|
||||
# WorkZoneBuildingArea.gd - 打工区建筑交互入口
|
||||
# ============================================================================
|
||||
# 为打工区建筑提供统一交互数据,玩家面对入口按交互键时由 PlayerController 调用。
|
||||
# ============================================================================
|
||||
|
||||
const INTERACTION_COLLISION_LAYER: int = 2
|
||||
|
||||
@export var buildingId: String = ""
|
||||
@export var buildingTitle: String = ""
|
||||
@export var buildingRole: String = ""
|
||||
|
||||
func _ready() -> void:
|
||||
collision_layer = INTERACTION_COLLISION_LAYER
|
||||
collision_mask = 0
|
||||
|
||||
func interact() -> void:
|
||||
var payload := {
|
||||
"buildingId": buildingId,
|
||||
"title": buildingTitle,
|
||||
"role": buildingRole,
|
||||
"nodePath": get_path(),
|
||||
}
|
||||
var eventSystem := get_node_or_null("/root/EventSystem")
|
||||
if eventSystem != null:
|
||||
eventSystem.call("emit_event", EventNames.OBJECT_INTERACTED, payload)
|
||||
print("WorkZone building interacted: %s - %s" % [buildingTitle, buildingRole])
|
||||
Reference in New Issue
Block a user