Ajout de contrôle sur l’ouverture des containers et un second paramètre de couleur

This commit is contained in:
yannk 2021-07-10 18:44:53 +02:00
parent e39e60323b
commit 717d7ad060
3 changed files with 15 additions and 6 deletions

View file

@ -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 )
if value < 0.0 or value > 100.0:
return
lid_angle = value
$container_lid.rotation_degrees = Vector3( -lid_angle, 0.0, 0.0 )

View file

@ -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 )]

View file

@ -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 )