// Updates timer, checks for using loot boxes. counts down FIFTEEN_MINUTES void FixedUpdate() { if (!notAtMaxLootBoxes) { if (User.user.LootBoxes < User.user.MaxLootBoxes) { notAtMaxLootBoxes = true; } else { return; } } DateTime epochStart = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); int current_time = (int)(DateTime.UtcNow - epochStart).TotalSeconds; int difference = current_time - User.user.LastTimeOpenedLootBox; if (lootBoxesText) { lootBoxesText.text = User.user.LootBoxes.ToString(); } if (timeRemainingText) { timeRemainingText.text = ConvertSecondsToMinutes(FIFTEEN_MINUTES - difference).ToString(); } if (difference >= FIFTEEN_MINUTES) { firebaseManager.AddLootBox(1); lootBoxesText.text = User.user.LootBoxes.ToString(); if (User.user.LootBoxes >= User.user.MaxLootBoxes) { notAtMaxLootBoxes = false; timeRemainingText.enabled = false; User.user.LootBoxes = User.user.MaxLootBoxes; firebaseManager.ResetLootBoxesBalance(); } else { timeTillNextLootBox += FIFTEEN_MINUTES; timeRemainingText.enabled = true; User.user.LastTimeOpenedLootBox = current_time; } } }