public void OnDifficultyChanged() { if (SceneManager.GetActiveScene().name == "Main Menu" == false) { float currentHealthPercent = currentHealth / maxHealth; maxHealth = baseHealth * PlayerPrefsController.GetDifficultyMultiplier_CastleHealth(); currentHealth = maxHealth * currentHealthPercent; UpdateDisplay(); } }
void Start() { currentHealth = baseHealth * PlayerPrefsController.GetDifficultyMultiplier_CastleHealth(); maxHealth = currentHealth; healthText = GetComponentInChildren <Text>(); healthBar = transform.Find("Health Bar").GetComponent <RectTransform>(); maskStartingWidth = healthBar.sizeDelta.x; levelController = LevelController.instance; UpdateDisplay(); }