private void loadHistoric(string instanceHistorics) { int index = 0; foreach (char choice in instanceHistorics) { if (index != 0 && index % NB_LVL_BETWEEN_AMJ == 0) { switch (choice) { case '1': AMJ.applyGunUpgrade(gunUpgradeList[indexGunUpgradeList]); indexGunUpgradeList++; break; case '2': AMJ.applySwordUpgrade(swordUpgradeList[indexSwordUpgradeList]); indexSwordUpgradeList++; break; case '3': AMJ.applyOtherUpgrade(otherUpgradeList[indexOtherUpgradeList]); indexOtherUpgradeList++; break; } } else { switch (choice) { case '1': CharacterController.Instance.applyStatUpgrade(stat1UpgradeList[indexStatUpgradeList]); break; case '2': CharacterController.Instance.applyStatUpgrade(stat2UpgradeList[indexStatUpgradeList]); break; case '3': CharacterController.Instance.applyStatUpgrade(stat3UpgradeList[indexStatUpgradeList]); break; } indexStatUpgradeList++; } index++; } }
public void ApplyChoiceUpgrade(int value) { DeserializeJson.instance.historics += value.ToString(); if (lastLevel % 10 == 0) { switch (value) { case 1: AMJ.applyGunUpgrade(gunUpgradeList[indexGunUpgradeList]); indexGunUpgradeList++; break; case 2: AMJ.applySwordUpgrade(swordUpgradeList[indexSwordUpgradeList]); indexSwordUpgradeList++; break; case 3: AMJ.applyOtherUpgrade(otherUpgradeList[indexOtherUpgradeList]); indexOtherUpgradeList++; break; } } else { StatUpgradeStruct struc; switch (value) { case 1: struc = stat1UpgradeList[indexStatUpgradeList]; break; case 2: struc = stat2UpgradeList[indexStatUpgradeList]; break; case 3: struc = stat3UpgradeList[indexStatUpgradeList]; break; } indexStatUpgradeList++; } }