parent
6a5494a3de
commit
e8559b7993
@ -0,0 +1,14 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
@export var isUp:bool = true
|
||||||
|
@export var upPosition:float = 45
|
||||||
|
@export var downPosition:float = -45
|
||||||
|
|
||||||
|
@onready var visual_lever: Node3D = $Visuals/VisualLever
|
||||||
|
|
||||||
|
signal changed(isUp: bool)
|
||||||
|
|
||||||
|
func _on_interactable_on_hit() -> void:
|
||||||
|
isUp = !isUp
|
||||||
|
changed.emit(isUp)
|
||||||
|
visual_lever.rotation_degrees.x = upPosition if isUp else downPosition
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://de5n8vxvigaic
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://cv3qpo5lfrchn"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://de5n8vxvigaic" path="res://prefabs/lever.gd" id="1_7d20a"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://be7u1kn41g2ww" path="res://addons/interaction/interactable.tscn" id="1_h71ec"]
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_h71ec"]
|
||||||
|
size = Vector3(1, 1, 0.2)
|
||||||
|
|
||||||
|
[sub_resource type="BoxMesh" id="BoxMesh_ib36p"]
|
||||||
|
size = Vector3(0.405, 0.61, 0.09)
|
||||||
|
|
||||||
|
[sub_resource type="BoxMesh" id="BoxMesh_haun4"]
|
||||||
|
size = Vector3(0.1, 0.1, 0.5)
|
||||||
|
|
||||||
|
[node name="Lever" type="Node3D"]
|
||||||
|
script = ExtResource("1_7d20a")
|
||||||
|
upPosition = -45.0
|
||||||
|
downPosition = 45.0
|
||||||
|
|
||||||
|
[node name="Interactable" parent="." instance=ExtResource("1_h71ec")]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Interactable"]
|
||||||
|
shape = SubResource("BoxShape3D_h71ec")
|
||||||
|
|
||||||
|
[node name="Visuals" type="Node3D" parent="."]
|
||||||
|
|
||||||
|
[node name="VisualBase" type="Node3D" parent="Visuals"]
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="Visuals/VisualBase"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.029395461)
|
||||||
|
mesh = SubResource("BoxMesh_ib36p")
|
||||||
|
|
||||||
|
[node name="VisualLever" type="Node3D" parent="Visuals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.70710677, 0.70710677, 0, -0.70710677, 0.70710677, 0, 0, 0.04011269)
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="Visuals/VisualLever"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00422913, 0.22320583)
|
||||||
|
mesh = SubResource("BoxMesh_haun4")
|
||||||
|
|
||||||
|
[connection signal="on_hit" from="Interactable" to="." method="_on_interactable_on_hit"]
|
||||||
Loading…
Reference in new issue