Activate teleport when all three knob (button) pressed?

Hi I am still very new to unity and especially scripting, I want to write a code for this scenario:

Currently there a big teleporter tube and 3 knob beside it, I want to enable teleporting when all 3 knob have been pressed, what code should I write?

I have the teleport script and onmousedown for the knob, but from there I have no clue how to link them together.

Perhaps something like this?

// let's say this script is attached to the tube and it's called TubeScript
var knob1 : boolean;
var knob2 : boolean;
var knob3 : boolean;

function Update(){

if (knob1  knob2  knob3)
teleport()

}
// and this script is attached to knob1

findTube = GameObject.Find("Tube");
	TubeScript = findTube.GetComponent(TubeScript);
	TubeScript.knob1 = "true";

I’m new to coding too, and haven’t tested this, but perhaps it gives you an idea how to solve your problem.

I think it should be enough to store the state (pressed, unpressed) for each of the knobs in a boolean var. If you use an Array of three boolean vars or three seperate depends on how you handle the knots.

If you use a single script for all of them, you should use an array. If you use a seperate script for every single knot, you should store a boolean var in that script.

To activate your teleporter you will have to check the state of this vars- if all of them are pressed (true), the teleporter should be enabled- if even one of the boolean values returns false, it should be disabled.

//Edit:

Too slow :smile: