feat: 更新 IntoHole 的球体、滑槽和环境资产
- 为铁球、陶瓷球和木球制作风格化材质,归档 CC0 原始参考 - 更新方形球洞和实心滑槽,统一 90° 弯槽并兼容旧存档 - 用顺流泡沫表示水流方向,为冰块制作三种交错的裂纹 - 同步 Blender 源资产、Godot 加载、工坊和试玩预览
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
extends RefCounted
|
||||
|
||||
const ALTERNATE_TEXTURES := [
|
||||
preload("res://assets/blocks/ice/textures/top_albedo_diagonal.png"),
|
||||
preload("res://assets/blocks/ice/textures/top_albedo_forked.png"),
|
||||
]
|
||||
const TOP_MATERIAL := "Storybook / ice top"
|
||||
|
||||
static var overrides: Dictionary[Texture2D, StandardMaterial3D] = {}
|
||||
|
||||
static func apply(visual: Node3D, location: Vector3) -> void:
|
||||
# X/Z grid neighbors differ by one or two steps in the three-pattern cycle.
|
||||
var pattern := posmod(roundi(location.x) + 2 * roundi(location.z), 3)
|
||||
if pattern == 0:
|
||||
return
|
||||
var texture: Texture2D = ALTERNATE_TEXTURES[pattern - 1]
|
||||
for node in visual.find_children("*", "MeshInstance3D", true, false):
|
||||
var mesh_view := node as MeshInstance3D
|
||||
for index in range(mesh_view.mesh.get_surface_count()):
|
||||
var source := mesh_view.mesh.surface_get_material(index) as StandardMaterial3D
|
||||
if source != null and source.resource_name == TOP_MATERIAL:
|
||||
if not overrides.has(texture):
|
||||
var material := source.duplicate() as StandardMaterial3D
|
||||
material.albedo_texture = texture
|
||||
overrides[texture] = material
|
||||
mesh_view.set_surface_override_material(index, overrides[texture])
|
||||
return
|
||||
Reference in New Issue
Block a user