Hello i am having a game where diferent buttons are going to open different doors.
The code for the button use is:
var ButtonNr : int;
//Private Variables
var isOn : boolean = false;
function Update ()
{
if(isOn)
{
//OpenDoor(ButtonNr);
}
}
public function UseButton()
{
if(isOn)
{
isOn = false;
renderer.material.color = Color.blue;
}
else if(!isOn)
{
isOn = true;
renderer.material.color = Color.green;
}
print(isOn);
}
As you can see i have commented out OpenDoor(ButtonNr) as i dont know how to call it in a diferent script. the other script looks as this:
var DoorOpen : boolean = false;
var DoorNr : int;
function OpenDoor(nr : int)
{
if( nr == DoorNr && !DoorOpen)
{
Destroy(gameObject);
}
}
i need it to test all of the doors if there button have been switch on is there a way to individualy check all doors ?
thanks for your time and i hope you will help