nomadro/apps/minigame-godot/scripts/poi_zone.gd
Eric 58a845db32 Add WeChat minigame triple-engine scaffold with Godot Chiang Mai plaza SoT.
Unity and Cocos stay as parallel schemes; apps/minigame ships the Godot 4.7 WeChat pack for DevTools.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-06 20:17:14 +08:00

53 lines
1.5 KiB
GDScript

extends Area3D
@export var title := "Spot"
@export var blurb := ""
signal entered_poi(title: String, blurb: String)
signal exited_poi(title: String)
func _ready() -> void:
add_to_group("poi")
monitoring = true
monitorable = false
collision_layer = 0
collision_mask = 1
body_entered.connect(_on_enter)
body_exited.connect(_on_exit)
var mark := MeshInstance3D.new()
var cyl := CylinderMesh.new()
cyl.top_radius = 0.55
cyl.bottom_radius = 0.55
cyl.height = 0.05
mark.mesh = cyl
var mat := StandardMaterial3D.new()
mat.albedo_color = Color(1.0, 0.75, 0.2, 0.55)
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
mat.emission_enabled = true
mat.emission = Color("F59E0B")
mat.emission_energy_multiplier = 0.8
mark.material_override = mat
mark.position = Vector3(0, 0.04, 0)
add_child(mark)
var label := Label3D.new()
label.text = title
label.font_size = 48
label.pixel_size = 0.012
label.position = Vector3(0, 2.4, 0)
label.modulate = Color(1, 0.95, 0.8)
label.outline_size = 8
label.outline_modulate = Color(0, 0, 0, 0.7)
add_child(label)
var tw := create_tween().set_loops()
tw.tween_property(label, "position:y", 2.7, 1.2).set_trans(Tween.TRANS_SINE)
tw.tween_property(label, "position:y", 2.4, 1.2).set_trans(Tween.TRANS_SINE)
func _on_enter(body: Node3D) -> void:
if body.is_in_group("player"):
entered_poi.emit(title, blurb)
get_tree().call_group("game", "on_poi_visited", title)
func _on_exit(body: Node3D) -> void:
if body.is_in_group("player"):
exited_poi.emit(title)