void SetupGame(Boolean reset)
{
// Reset the game if the user goes back to the main menu, else advance to the next level.
if (reset)
{
died = false;
won = false;
playerObject.Reset(true);
if (level < 3)
{
ghost1.Reset(true);
}
else if (level < 5)
{
ghost1.Reset(true);
ghost2.Reset(true);
ghost2.gameObject.SetActive(false);
}
else if (level < 7)
{
ghost1.Reset(true);
ghost2.Reset(true);
ghost3.Reset(true);
ghost2.gameObject.SetActive(false);
ghost3.gameObject.SetActive(false);
}
else
{
ghost1.Reset(true);
ghost2.Reset(true);
ghost3.Reset(true);
ghost4.Reset(true);
ghost2.gameObject.SetActive(false);
ghost3.gameObject.SetActive(false);
ghost4.gameObject.SetActive(false);
}
level = 1;
}
else
{
level++;
won = false;
died = false;
playerObject.Reset(false);
if (level == 3)
{
ghost2.gameObject.SetActive(true);
ghost2.Start();
}
else if (level == 5)
{
ghost3.gameObject.SetActive(true);
ghost3.Start();
}
else if (level == 7)
{
ghost4.gameObject.SetActive(true);
ghost4.Start();
}
if (level < 3)
{
ghost1.Reset(false);
}
else if (level < 5)
{
ghost1.Reset(false);
ghost2.Reset(false);
}
else if (level < 7)
{
ghost1.Reset(false);
ghost2.Reset(false);
ghost3.Reset(false);
}
else
{
ghost1.Reset(false);
ghost2.Reset(false);
ghost3.Reset(false);
ghost4.Reset(false);
}
}
foreach (var pellet in pellets)
{
Pellet pelletObject = pellet.GetComponent <Pellet>();
pelletObject.Start();
}
foreach (var powerup in powerups)
{
Powerup powerupObject = powerup.GetComponent <Powerup>();
powerupObject.Start();
}
foreach (var speedup in speedups)
{
SpeedUp speedupObject = speedup.GetComponent <SpeedUp>();
speedupObject.Start();
}
foreach (var doublepoint in doublepoints)
{
DoublePoints doublepointObject = doublepoint.GetComponent <DoublePoints>();
doublepointObject.Start();
}
}