/// <summary> /// Applies the selected <see cref="LevelCompletionInfo"/>, or makes a new one if it is null. /// </summary> /// <param name="completionInfo">The level completion status to apply, null makes a new one</param> /// <param name="timeRemaining">The time remaining for this level</param> public void LoadSave(LevelCompletionInfo completionInfo = default, float timeRemaining = LevelCompletionInfo.DefaultTime) { if (completionInfo == default) { if (SaveFileManager.IsFileOpened) { CurrentCompletionInfo = Level.GetSaveFileInfo(SaveFileManager.Current); } else { CurrentCompletionInfo = new LevelCompletionInfo() { LevelName = Level.Name, LevelWorldName = Level.LevelWorldName, TimeRemaining = timeRemaining } }; } else { CurrentCompletionInfo = completionInfo; } if (CurrentCompletionInfo != null) { CurrentCompletionInfo.TimeRemaining = timeRemaining; CurrentCompletionInfo.PattiesCollected = 0; CurrentCompletionInfo.BonusesCollected = 0; } if (!Pickups.ContainsKey("TIME")) { Pickups.Add("TIME", new WorldPickupDefinition(timeRemaining, timeRemaining)); } }
/// <summary> /// Sets the remaining time in seconds /// </summary> /// <param name="SecondsRemaining"></param> public void UpdateTimeRemaining(int SecondsRemaining) { if (Pickups.ContainsKey("TIME")) { Pickups["TIME"] = new WorldPickupDefinition(SecondsRemaining, Pickups["TIME"].AmountTotal); } else { AddPickup("TIME"); } }