private void CalculateOfflineRewards() { int allSecondsPassed = minutesPassed * 60 + PlayerPrefs.GetInt("rewardSecondsAlreadyPassed"); minutesPassed += Mathf.FloorToInt(PlayerPrefs.GetInt("rewardSecondsAlreadyPassed") / 60); if (minutesPassed >= RewardIntervalMinute) { inGameManager.ChangeHeartAmount(Mathf.FloorToInt(minutesPassed / RewardIntervalMinute)); Debug.Log("hearts to add to player: " + Mathf.FloorToInt(minutesPassed / RewardIntervalMinute)); } else { Debug.Log("Not enough time passed."); } if (PlayerPrefs.GetInt("ActiveHearts") < inGameManager.GetMaxHeart()) { StartCoroutine("RewardTimer", allSecondsPassed % (RewardIntervalMinute * 60)); } }