godot-third-person-basic-scene/maps/objects/ashtarie-bench.gd

44 lines
1.9 KiB
GDScript

@tool
extends Node3D
@export var railways: bool = true:
get:
return railways
set(value):
railways = value
@export var main_color: Color = Color(0.494117647059, 0.141176470588, 0.117647058824, 1.0):
get:
return main_color
set(value):
main_color = value
_set_main_color(value)
@export var secondary_color: Color = Color(0.862745098039, 0.6, 0.117647058824, 1.0):
get:
return secondary_color
set(value):
secondary_color = value
_set_secondary_color(value)
func _set_main_color(value) -> void:
get_node("railways/back-fence").mesh.surface_get_material(1).set_shader_param("base_color", value)
get_node("railways/sidewaysL").mesh.surface_get_material(1).set_shader_param("base_color", value)
get_node("railways/sidewaysR").mesh.surface_get_material(1).set_shader_param("base_color", value)
get_node("polesL").mesh.surface_get_material(0).set_shader_param("base_color", value)
get_node("polesR").mesh.surface_get_material(0).set_shader_param("base_color", value)
get_node("supports-back").mesh.surface_get_material(1).set_shader_param("base_color", value)
get_node("supports-side").mesh.surface_get_material(1).set_shader_param("base_color", value)
get_node("back-top-bottom").mesh.surface_get_material(0).albedo_color = value
func _set_secondary_color(value) -> void:
get_node("railways/back-fence").mesh.surface_get_material(1).set_shader_param("decor_color", value)
get_node("railways/sidewaysL").mesh.surface_get_material(1).set_shader_param("decor_color", value)
get_node("railways/sidewaysR").mesh.surface_get_material(1).set_shader_param("decor_color", value)
get_node("polesL").mesh.surface_get_material(0).set_shader_param("decor_color", value)
get_node("polesR").mesh.surface_get_material(0).set_shader_param("decor_color", value)
get_node("supports-back").mesh.surface_get_material(1).set_shader_param("decor_color", value)
get_node("supports-side").mesh.surface_get_material(1).set_shader_param("decor_color", value)