//=== public void OnClick_Upgrade() { if (DataHandler.Instance.playerTraps.Count <= 0) { EffectHandler.Instance.SystemMessage("No spirits to upgrade"); } else if (GameManager.Instance.playerData.gold < upgradeCost) { EffectHandler.Instance.SystemMessage("Not enough gold"); } else { GameManager.Instance.playerData.gold -= upgradeCost; GameManager.Instance.playerData.trapUpgradeCount++; Trap.EnhancedRate += enhancedRate_upRateByCount / 100; for (int i = 0; i < DataHandler.Instance.playerTraps.Count; i++) { GameObject slotObj = contentObj.transform.GetChild(i).gameObject; Animator anim = slotObj.GetComponent <Animator>(); anim.Play("expand"); Trap trap = DataHandler.Instance.playerTraps[i]; float per = Random.Range(0, 100); float percent = DataHandler.Instance.GetGradeUpPercentage(trap.form.grade); percent = percent + (percent * (DataHandler.rankUpExtraRate / 100)) * percentageMult; if (per <= 50 + percent / 2 && per >= 50 - percent / 2) { Grade targetGrade = (Grade)((int)trap.form.grade + 1); List <TrapForm> supForms = DataHandler.Instance.GetTrapFormsAtGrade(targetGrade); int index = Random.Range(0, supForms.Count); trap.ChangeForm(supForms[index]); } trap.ReStat(); } AudioHandler.Instance.PlaySFX(AudioHandler.Instance.sfxFolder[0]); GameManager.Instance.SaveGame(); UpdateList(); } }