/// <summary> Removes the proper toggle based on type of togger and name </summary> /// <param name="type"> Type of power were removing a toggle for </param> /// <param name="name"> Name of the power were removing the toggle for </param> private void RemoveToggle(ShopItem.PowerType type, string name) { int i = 0; switch (type) { case ShopItem.PowerType.Perma: foreach (string item in PermPowerUps) { if (name == item) { PermPowerSettings.RemoveAt(i); break; } i++; } break; case ShopItem.PowerType.Vanity: foreach (string item in VanityItems) { if (name == item) { VanitySettings.RemoveAt(i); break; } i++; } break; } }
/// <summary> Adds a new toggle to a list of toggles of choice </summary> /// <param name="type"> Type of power were adding a toggle for </param> private void AddToggle(ShopItem.PowerType type) { switch (type) { case ShopItem.PowerType.Perma: PermPowerSettings.Add(true); break; case ShopItem.PowerType.Vanity: VanitySettings.Add(true); break; } }
/// <summary> Saves just the arrays for powerup manader </summary> /// <param name="type"> Type of arrays were saving </param> private void SaveArray(ShopItem.PowerType type) { switch (type) { case ShopItem.PowerType.Perma: GameManager.saveData.Perma = new string[PermPowerUps.Count]; GameManager.saveData.PermaToggles = new bool[PermPowerUps.Count]; for (int i = 0; i < GameManager.saveData.Perma.Length; ++i) { GameManager.saveData.Perma[i] = PermPowerUps[i]; GameManager.saveData.PermaToggles[i] = PermPowerSettings[i]; } break; case ShopItem.PowerType.Temp: GameManager.saveData.Temp = new string[TempPowerUps.Count]; for (int i = 0; i < GameManager.saveData.Temp.Length; ++i) { GameManager.saveData.Temp[i] = TempPowerUps[i]; } GameManager.saveData.TempCount = new int[TempPowerCounts.Count]; for (int i = 0; i < GameManager.saveData.TempCount.Length; ++i) { GameManager.saveData.TempCount[i] = TempPowerCounts[i]; } break; case ShopItem.PowerType.Vanity: GameManager.saveData.Vanity = new string[VanityItems.Count]; GameManager.saveData.VanityToggles = new bool[VanityItems.Count]; for (int i = 0; i < GameManager.saveData.Vanity.Length; ++i) { GameManager.saveData.Vanity[i] = VanityItems[i]; GameManager.saveData.VanityToggles[i] = VanitySettings[i]; } break; } GameManager.saveData.PowersOn = CurrentUsedPowers; GameSaveSystem.Instance.SaveGame(); }