feat: 增加NPC范鲸晶

- player场景增加RayCast2D
- 增加npc场景
- 增加NPC对话气泡
This commit is contained in:
2026-01-11 00:10:45 +08:00
parent ed7d89e39d
commit 8a5a4a0005
11 changed files with 211 additions and 1 deletions

9
scenes/ui/ChatBubble.gd Normal file
View File

@@ -0,0 +1,9 @@
extends Control
@onready var label = $PanelContainer/Label
func set_text(text):
label.text = text
# Destroy after 5 seconds
await get_tree().create_timer(5.0).timeout
queue_free()

View File

@@ -0,0 +1 @@
uid://b4aorojcbwkmb

42
scenes/ui/ChatBubble.tscn Normal file
View File

@@ -0,0 +1,42 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="Script" uid="uid://b4aorojcbwkmb" path="res://scenes/ui/ChatBubble.gd" id="1_script"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bubble_modern"]
bg_color = Color(1, 1, 1, 0.9)
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
shadow_color = Color(0, 0, 0, 0.2)
shadow_size = 2
[node name="ChatBubble" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_script")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -75.0
offset_top = -60.0
offset_right = 75.0
offset_bottom = -20.0
grow_horizontal = 2
grow_vertical = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_bubble_modern")
[node name="Label" type="Label" parent="PanelContainer"]
layout_mode = 2
theme_override_colors/font_color = Color(0.1, 0.1, 0.1, 1)
theme_override_font_sizes/font_size = 8
text = "..."
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 3
custom_minimum_size = Vector2(150, 0)