示例#1
0
    private void ReserveAcquired(ReserveAcquired reserve)
    {
        itemGot = reserve.gameObject;
        var ammo       = inventory.limitedAmmo;
        var ammoSearch = inventory.limitedAmmoSearch;

        switch (reserve.ItemType)
        {
        case ReserveType.Missile:
            ammo[0].AddCapacity(999);
            break;

        case ReserveType.SuperMissile:
            //Check if is the first time on get the item.
            if (!ammoSearch.ContainsKey(1))
            {
                PlayerInventory.CountableAmmo newAmmo =
                    new PlayerInventory.CountableAmmo(false, 1, defaultAmmoPrefabs[0], 0, 0);
                ammoSearch.Add(1, newAmmo);
                if (ammo.Count > 1)
                {
                    List <PlayerInventory.CountableAmmo> aux = new List <PlayerInventory.CountableAmmo>();
                    aux.Add(ammo[0]);
                    aux.Add(newAmmo);
                    aux.Add(ammo[1]);
                    inventory.limitedAmmo = aux;
                }
                else
                {
                    ammo.Add(newAmmo);
                }
                hudUI.AddAndSubscribe(1);
            }
            ammoSearch[1].AddCapacity(999);
            break;

        case ReserveType.SuperBomb:
            //Check if is the first time on get the item.
            if (!ammoSearch.ContainsKey(2))
            {
                PlayerInventory.CountableAmmo newAmmo =
                    new PlayerInventory.CountableAmmo(false, 2, defaultAmmoPrefabs[1], 0, 0);
                ammoSearch.Add(2, newAmmo);
                ammo.Add(newAmmo);
                hudUI.AddAndSubscribe(2);
            }
            ammoSearch[2].AddCapacity(20);
            break;

        case ReserveType.EnergyTank:
            GameEvents.healthTank.Invoke();
            break;
        }
        AddToPlayerInventory(reserve);
        audioPlayer.ClipAndPlay(reserveAcquired);
        panel.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = reserve.nameItem;
        Pause.onAnyMenu = true;
    }
示例#2
0
 public void SetEffectsVolume(float volume)
 {
     if (CheckVolumeLevel(volume))
     {
         onPause.SetFloat(soundVolume, volumeLevel    = volume);
         audioMixer.SetFloat(soundVolume, volumeLevel = volume);
         if (!setMute)
         {
             audioS.ClipAndPlay(sampleClip);
         }
     }
     SaveSystem.SaveSettings(volumeLevel, musicLevel);
 }
示例#3
0
 private void SetDamage(int amount)
 {
     Damage(amount);
     audioPlayer.loop = false;
     audioPlayer.ClipAndPlay(damageClip);
 }