29 lines
587 B
GDScript3
Raw Normal View History

2019-11-22 11:11:10 +01:00
extends StaticBody
2019-12-28 18:36:48 +01:00
#export variables
export(bool) var is_on = false
export(bool) var is_color_input = false
export(bool) var is_machine_start = false
onready var lever_mesh = get_node("LeverMesh")
2019-12-14 21:05:09 +01:00
onready var outline = get_node("LeverMesh/Outline") as MeshInstance
2019-11-22 11:11:10 +01:00
2019-12-28 18:36:48 +01:00
var blocked = false
2019-11-22 11:11:10 +01:00
2019-12-28 18:36:48 +01:00
# signals
signal flow_changed
signal start_machine
2019-11-22 11:11:10 +01:00
2019-12-14 21:05:09 +01:00
func do_interact(var player):
2019-12-28 18:36:48 +01:00
if not blocked:
flick()
if is_color_input:
emit_signal("flow_changed")
if is_machine_start:
emit_signal("start_machine")
func flick():
set_scale(Vector3(scale.x, -scale.y, scale.z))
is_on = !is_on