/// <summary> /// Sets perameters of the weapon. /// If there is no given weapon, it will be added. /// Otherwise, data will be rewritten. /// </summary> public void Set(WeaponIndex weapon, int health, bool isBought, bool isSelected) { if (isSelected) { selectedWeapons.Push(weapon); } else { selectedWeapons.Remove(weapon); } if (playerWeapons.ContainsKey(weapon)) { playerWeapons[weapon].IsBought = isBought; playerWeapons[weapon].HealthRef.Value = health; } else { playerWeapons.Add(weapon, new WeaponItem(this, weapon, health, isBought)); } }