Hello. I wrote a CountDownTimer.cs class for displaying the time left on my online multiplayer -game. Now i want to extend it with two more timers like:
private CountDownTimer RoundTimer;
private CountDownTimer SpawnTimer;
private CountDownTimer HideTimer;
If I inicialize them like:
void Start()
{
isGameStarted = false;
RoundTimer = GetComponent<CountDownTimer>();
SpawnTimer = GetComponent<CountDownTimer>();
HideTimer = GetComponent<CountDownTimer>();
}
…then of course, if I try to display them all the timers will be the same, because their source is only on component. My question is:
-
Do I have to make my CountDownTimer
class abstract and make three derived
class from it for each timer and put
them on a GameObject so I can have
them by GetComponent -
or make three empty child on my
GameLogic GameObject and use the same
CountDownTimer on them. So I can have
them separately somehow. -
or is there a better solution?
Thanks