feat: update
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
[gd_scene format=3 uid="uid://iinjrl0ujfnh"]
|
||||
|
||||
[sub_resource type="SphereMesh" id="1"]
|
||||
radius = 0.2
|
||||
height = 0.4
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="2"]
|
||||
albedo_color = Color(1, 1, 1, 1)
|
||||
metallic = 0.3
|
||||
roughness = 0.4
|
||||
|
||||
[node name="Candy" type="Node3D"]
|
||||
|
||||
[node name="Mesh" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("1")
|
||||
material_override = SubResource("2")
|
||||
@@ -112,4 +112,4 @@ theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 5
|
||||
theme_override_fonts/font = ExtResource("1_font")
|
||||
text = ""
|
||||
horizontal_alignment = 1
|
||||
horizontal_alignment = 1
|
||||
|
||||
+25
-24
@@ -605,40 +605,41 @@ func _get_all_mesh_instances(node: Node) -> Array:
|
||||
# RPCs
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
var _candy_scene: PackedScene = preload("res://scenes/candy.tscn")
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_candy_stack(count: int, color_id: int) -> void:
|
||||
var visuals = get_node_or_null("Visuals")
|
||||
if not visuals: return
|
||||
|
||||
var old_stack = visuals.get_node_or_null("CandyStack")
|
||||
func sync_candy_stack(colors: Array) -> void:
|
||||
var old_stack = get_node_or_null("CandyStack")
|
||||
if old_stack:
|
||||
old_stack.queue_free()
|
||||
|
||||
if count <= 0: return
|
||||
if colors.is_empty() or not _candy_scene: return
|
||||
|
||||
var stack_node = Node3D.new()
|
||||
stack_node.name = "CandyStack"
|
||||
visuals.add_child(stack_node)
|
||||
add_child(stack_node)
|
||||
|
||||
stack_node.position = Vector3(0, 2.0, 0)
|
||||
stack_node.position = Vector3(0, 1.8, 0)
|
||||
|
||||
# Determine base tile and override material based on the mode config or default tile meshes
|
||||
var mesh_path = "res://assets/models/tiles/tile_heart.tres"
|
||||
match color_id:
|
||||
0: mesh_path = "res://assets/models/tiles/tile_heart.tres"
|
||||
1: mesh_path = "res://assets/models/tiles/tile_diamond.tres"
|
||||
2: mesh_path = "res://assets/models/tiles/tile_star.tres"
|
||||
3: mesh_path = "res://assets/models/tiles/tile_coin.tres"
|
||||
|
||||
var tile_mesh = load(mesh_path)
|
||||
if not tile_mesh: return
|
||||
var candy_colors = {
|
||||
0: Color(1.0, 0.3, 0.3), # HEART = red
|
||||
1: Color(0.3, 0.6, 1.0), # DIAMOND = blue
|
||||
2: Color(1.0, 0.8, 0.0), # STAR = gold
|
||||
3: Color(0.0, 1.0, 0.4), # COIN = green
|
||||
}
|
||||
|
||||
for i in range(count):
|
||||
var mi = MeshInstance3D.new()
|
||||
mi.mesh = tile_mesh
|
||||
mi.position = Vector3(0, i * 0.4, 0)
|
||||
mi.scale = Vector3(0.5, 0.5, 0.5)
|
||||
stack_node.add_child(mi)
|
||||
for i in range(colors.size()):
|
||||
var color_id = colors[i]
|
||||
var base_color = candy_colors.get(color_id, Color.WHITE)
|
||||
var candy = _candy_scene.instantiate()
|
||||
candy.position = Vector3(0, i * 0.35, 0)
|
||||
# Tint material to match color
|
||||
var mesh = candy.get_node_or_null("Mesh")
|
||||
if mesh and mesh.material_override:
|
||||
var mat = mesh.material_override.duplicate()
|
||||
mat.albedo_color = base_color
|
||||
mesh.material_override = mat
|
||||
stack_node.add_child(candy)
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_character(character_name: String) -> void:
|
||||
|
||||
Reference in New Issue
Block a user