How to make this shorter.I m a beginner so i dont know much yet but i think i might an array but i dont know how to set it up. Here is the code
void HpUpgradelvl()
{
if (PlayerControl.coins >= 30)
{
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 60)
{
txt.SetActive(false);
txt1.SetActive(true);
txt2_0.SetActive(false);
txt2_1.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 100)
{
txt1.SetActive(false);
txt2.SetActive(true);
txt2_1.SetActive(false);
txt2_2.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 150)
{
txt2.SetActive(false);
txt3.SetActive(true);
txt2_2.SetActive(false);
txt2_3.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 210)
{
txt3.SetActive(false);
txt4.SetActive(true);
txt2_3.SetActive(false);
txt2_4.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 280)
{
txt4.SetActive(false);
txt5.SetActive(true);
txt2_4.SetActive(false);
txt2_5.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 360)
{
txt5.SetActive(false);
txt6.SetActive(true);
txt2_5.SetActive(false);
txt2_6.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 450)
{
txt6.SetActive(false);
txt7.SetActive(true);
txt2_6.SetActive(false);
txt2_7.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 500)
{
txt7.SetActive(false);
txt8.SetActive(true);
txt2_7.SetActive(false);
txt2_8.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 610)
{
txt8.SetActive(false);
txt9.SetActive(true);
txt2_8.SetActive(false);
txt2_9.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 730)
{
txt9.SetActive(false);
txt10.SetActive(true);
txt2_9.SetActive(false);
txt2_10.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 860)
{
txt10.SetActive(false);
txt11.SetActive(true);
txt2_10.SetActive(false);
txt2_11.SetActive(true);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
if (PlayerControl.coins >= 1000)
{
txt11.SetActive(false);
txtmax.SetActive(true);
imgmax.SetActive(false);
txt2_11.SetActive(false);
txtmax2.SetActive(true);
imgmax2.SetActive(false);
healthPoints = healthPoints + 10;
PlayerPrefs.SetFloat("HealthUP", healthPoints);
}
}
}
}
}
}
}
}
}
}
}
}
}
else healthPoints = 100;
}