public void SelectUpgrade(UPGRADE selected) { switch (selected) { case UPGRADE.DAMAGE: mAdditiveDamage += 5; break; case UPGRADE.FIRE_RATE: mFireRate += 0.1f; break; case UPGRADE.CRIT_RATE: mCritRate += 0.25f; break; case UPGRADE.DOUBLE_BULLET: mHasDoubleBullet = true; break; default: break; } StartCoroutine(DelayResumeGame()); }
//Call on scene load public static bool ApplyUpgrade(UPGRADE up) { bool Sucess = false; switch (up) { case UPGRADE.HEALTH: Sucess = ApplyHealth(); break; case UPGRADE.DASH: Sucess = ApplyDash(); break; case UPGRADE.DMG: Sucess = ApplyDMG(); break; case UPGRADE.BOUNCY: Sucess = ApplyBounce(); break; case UPGRADE.FIRERATE: Sucess = ApplyFireRate(); break; case UPGRADE.MULTISHOT: Sucess = ApplyMultishot(); break; default: Sucess = false; break; } PlayerPrefs.Save(); return(Sucess); }
public static int GetUpgradeCost(int p_upgrade) { UPGRADE upgrade = (UPGRADE)p_upgrade; int multiplier = 0; switch (upgrade) { case UPGRADE.HEALTH: multiplier = PlayerPrefs.GetInt(GlobalConfigs.HealthUpgrade); break; case UPGRADE.DASH: multiplier = PlayerPrefs.GetInt(GlobalConfigs.DashCooldownUpgrade); break; case UPGRADE.DMG: multiplier = PlayerPrefs.GetInt(GlobalConfigs.DamageUpgrade); break; case UPGRADE.BOUNCY: multiplier = PlayerPrefs.GetInt(GlobalConfigs.Bouncy); break; case UPGRADE.FIRERATE: multiplier = (int)PlayerPrefs.GetFloat(GlobalConfigs.FireRate); break; case UPGRADE.MULTISHOT: multiplier = PlayerPrefs.GetInt(GlobalConfigs.MultiShot); break; default: break; } return(5 + (multiplier * 5)); }