I am trying to build a weather system, where if 12 hours pass every gameObject with a script will have its function called. The script that has the variables passes on a variable, and then the script would process this to change its own according to what was to be changed at that point in time.
So i have a WeatherManager which its going to rain 20mm throughout the day. When the rain starts, call the function accross all scripts in the scene taking the WeatherManager’s 20mm value and process it to identify how much it will fill over 12 hours. Or otherwise just a rate.
A Retainer will then set a rate to refill itself at and gain a variable based on 20mm. And the Retainer will gain over 12 hours 200L of water.
I am uncertain if their is a way to make a function of my own or not. The only way i could make stuff happen as i want is to put everything i want it to do into the Start function. Set Gameobject.Setactive(false) then back to true. And then that function will run.
How could i achive that same thing by just calling it through my manager at a certain point in time?
//Every gameObject with this script.
float tankFill = 0;
float incriment_Rate = 0;
public void WeatherCast(int inputRequest)
incriment_Rate = inputRequest;
tankFill += incriment_Rate * Time.deltaTime;
float outRequest = 3.3f;
if(Time.time >= twelveHourMarkSet)
twelveHourMarkSet = Time.time + 12;