Ejemplo n.º 1
0
        public WeaponItem Get(WeaponIndex w)
        {
            WeaponItem item = playerWeapons[w];

            // check weapon's health, if it's out of bounds, clamp it
            item.Health = Mathf.Clamp(item.Health, 0, item.Durability);

            // normalize other values
            if (item.Health == 0 && !item.IsAmmo)
            {
                item.IsBought = false;
                selectedWeapons.Remove(w);
            }

            return(item);
        }
Ejemplo n.º 2
0
        public bool IsSelected(WeaponIndex index)
        {
            WeaponItem item = playerWeapons[index];

            return(selectedWeapons.Contains(index) && !(item.Health == 0 && !item.IsAmmo));
        }