I have a script A that receives a bool input (bool t1) from a toggle button and sets a bool field (hydro.t1Bool) with the bool received from the toggle like this:
HydroElectric hydro;
public bool t1;
public void turbine1State (bool t1) {
hydro.t1Bool = t1;
}
I have a script B with a function (inside the HydroElectric object) that returns a value according to this field Bool:
public float ControlPanel ()
{
turbina1 = t1Bool ? 1.5F : 0;
prod = turbina1 ;//+ turbina2 + turbina3;
return prod;
}
Then I have a script C that calls the ControlPanel() function from the object Hydroeletric and shows it on screen:
producao.text = hydro.ControlPanel().ToString();
My problem is that I need to make this hydro.t1Bool static for this dynamic to work. But to make t1Bool static I need to make its class static, but then I can't have a constructor (which I have) I can't declare instance members and my script A won't work because I can't declare variables of static types.
How can I make t1Bool static and avoid all this limitations?