initial shit
This commit is contained in:
33
Objects/Scripts/I3PositionSwitch.gd
Normal file
33
Objects/Scripts/I3PositionSwitch.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends Node3D
|
||||
|
||||
signal incremented
|
||||
signal decremented
|
||||
signal switchUpdated
|
||||
|
||||
@export var State = 0
|
||||
@export var isLoopingUpdate : bool = false
|
||||
|
||||
func _interact_press(is_alt_click: bool = false) -> void:
|
||||
if is_alt_click:
|
||||
if State != 0:
|
||||
State -= 1
|
||||
$Sound.play()
|
||||
emit_signal("decremented")
|
||||
emit_signal("switchUpdated")
|
||||
else:
|
||||
if State != 2:
|
||||
State += 1
|
||||
$Sound.play()
|
||||
emit_signal("incremented")
|
||||
emit_signal("switchUpdated")
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if State == 0:
|
||||
$StaticBody3D.rotation_degrees = Vector3(0, 45, 0)
|
||||
elif State == 1:
|
||||
$StaticBody3D.rotation_degrees = Vector3(0, 0, 0)
|
||||
elif State == 2:
|
||||
$StaticBody3D.rotation_degrees = Vector3(0, -45, 0)
|
||||
|
||||
if isLoopingUpdate:
|
||||
emit_signal("switchUpdated")
|
||||
Reference in New Issue
Block a user