extends BaseGate

var GateMeshInstance = MeshInstance3D.new()
var GateMesh = BoxMesh.new()

var CollisionShape = CollisionShape3D.new()
var CollisionMesh = BoxShape3D.new()

var GateState : bool

func _ready() -> void:
	add_child(GateMeshInstance)
	add_child(CollisionShape)
	CollisionShape.shape = CollisionMesh
	CollisionShape.scale = Vector3(0.3, 0.3, 0.3)

	GateMeshInstance.mesh = GateMesh
	GateMeshInstance.scale = Vector3(0.3, 0.3, 0.3)
	Pegs = [Peg.new()]
	Pegs[0].Type = Peg.Types.OUTPUT
	Pegs[0].position = Vector3(0,0.15,0)
	add_child(Pegs[0])



func _gateBehaviour():
	if GateState:
		Pegs[0].State = Peg.States.ON
	else:
		Pegs[0].State = Peg.States.OFF

func _press():
	GateState = not GateState
