From 717d7ad060fdd8f3f49017723fe7ebfde7913d9b Mon Sep 17 00:00:00 2001 From: yannk Date: Sat, 10 Jul 2021 18:44:53 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20contr=C3=B4le=20sur=20l=E2=80=99ou?= =?UTF-8?q?verture=20des=20containers=20et=20un=20second=20param=C3=A8tre?= =?UTF-8?q?=20de=20couleur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meshes/props/travel_box/container.gd | 17 ++++++++++++----- meshes/props/travel_box/container.tscn | 2 ++ meshes/props/travel_box/container_lid.tscn | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/meshes/props/travel_box/container.gd b/meshes/props/travel_box/container.gd index e9b5114..e18c5b9 100644 --- a/meshes/props/travel_box/container.gd +++ b/meshes/props/travel_box/container.gd @@ -3,12 +3,19 @@ extends Spatial export( Color ) var color = Color( 1.0, 1.0, 1.0, 1.0 ) setget set_color func set_color( value ): - color = value - $container_bottom/container_bottom.get_surface_material( 0 ).albedo_color = self.color - $container_lid/container_lid.get_surface_material( 0 ).albedo_color = self.color + color = value + $container_bottom/container_bottom.get_surface_material( 0 ).albedo_color = self.color + $container_lid/container_lid.get_surface_material( 0 ).albedo_color = self.color +export( Color ) var color2 = Color( 1.0, 1.0, 1.0, 1.0 ) setget set_color2 +func set_color2( value ): + color2 = value + $container_bottom/container_bottom.get_surface_material( 1 ).albedo_color = self.color2 + $container_lid/container_lid.get_surface_material( 1 ).albedo_color = self.color2 export( float ) var lid_angle = 0.0 setget set_lid_angle func set_lid_angle( value ): - lid_angle = value - $container_lid.rotation_degrees = Vector3( -lid_angle, 0.0, 0.0 ) \ No newline at end of file + if value < 0.0 or value > 100.0: + return + lid_angle = value + $container_lid.rotation_degrees = Vector3( -lid_angle, 0.0, 0.0 ) diff --git a/meshes/props/travel_box/container.tscn b/meshes/props/travel_box/container.tscn index 21d0ab0..f35cece 100644 --- a/meshes/props/travel_box/container.tscn +++ b/meshes/props/travel_box/container.tscn @@ -6,6 +6,8 @@ [node name="container" type="Spatial"] script = ExtResource( 3 ) +color = Color( 0.0352941, 0.0431373, 0.0627451, 1 ) +color2 = Color( 0.168627, 0.172549, 0.211765, 1 ) [node name="container_bottom" parent="." instance=ExtResource( 1 )] diff --git a/meshes/props/travel_box/container_lid.tscn b/meshes/props/travel_box/container_lid.tscn index 45e39c7..8790d19 100644 --- a/meshes/props/travel_box/container_lid.tscn +++ b/meshes/props/travel_box/container_lid.tscn @@ -5,7 +5,7 @@ [ext_resource path="res://materials/tilables/base_plastic_hard_shiny.material" type="Material" id=3] [ext_resource path="res://materials/tilables/base_steel_glossy.material" type="Material" id=4] -[node name="container_lid" instance=ExtResource( 1 )] +[node name="container_lid" index="0" instance=ExtResource( 1 )] [node name="container_lid" parent="." index="0"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )