Exemplo n.º 1
0
        // Listen for values in respective classes ( PUI_Inventory )
        private void UiUpdate(InventorySlotAmmo item, int clipLeft)
        {
            DividedBarShaderController bar = null;

            UIMappings.TryGetValue(item.Slot, out bar);

            if (ItemEquippableEvents.currentItem != null &&
                ItemEquippableEvents.currentItem.ItemDataBlock.inventorySlot.Equals(item.Slot) &&
                ItemEquippableEvents.IsCurrentItemShootableWeapon())
            {
                //Debug.Log("Ammo update event (main or sub weapon): " + "MaxAmmo: " + item.BulletClipSize + " Current ammo: " + clipLeft + " Inventory slot: " + item.Slot);
                BulletsInMag.maxAmmo = item.BulletClipSize;
                BulletsInMag.UpdateCurrentAmmo(clipLeft);
                BulletsInMag.UpdateAmmoGridDivisions();
                BulletsInMag.inventorySlot = item.Slot;
            }


            if (bar)
            {
                //Debug.Log("Ammo update event: " + "MaxAmmo: " + item.BulletClipSize + " Current ammo: " + clipLeft + " maxCap: " + item.BulletsMaxCap + " RelInPack " + item.RelInPack + " Inventory slot: " + item.Slot);
                bar.maxAmmo     = item.BulletsMaxCap;
                bar.currentAmmo = (int)(bar.maxAmmo * item.RelInPack);
                bar.SetFill(item.RelInPack);

                if (item.Slot.Equals(InventorySlot.Consumable) || item.Slot.Equals(InventorySlot.ResourcePack) || item.Slot.Equals(InventorySlot.ConsumableHeavy))
                {
                    bar.UpdatePackOrConsumableDivisions();
                }
            }
        }
Exemplo n.º 2
0
 public static void UpdateHealth(float health)
 {
     if (Health)
     {
         Health.SetFill(health);
     }
 }
Exemplo n.º 3
0
        public void UpdateAir(float val)
        {
            if (m_oxygenDisplay)
            {
                if (val < .95f && m_currentState == WatchState.Inventory)
                {
                    m_oxygenDisplay.SetFill(val);
                    m_oxygenDisplay.UpdateFill((int)(val * 100f));
                    m_oxygenDisplay.ToggleRendering(true);

                    if (val < 0.5)
                    {
                        m_oxygenDisplay.SetColor(Color.Lerp(Color.red, m_normalOxygenCol, val * 1.6f));
                    }
                    else
                    {
                        m_oxygenDisplay.SetColor(Color.cyan);
                    }
                }
                else
                {
                    m_oxygenDisplay.ToggleRendering(false);
                }
            }
        }
Exemplo n.º 4
0
 public static void UpdateInfection(float infection)
 {
     if (Infection)
     {
         Infection.SetFill(infection);
     }
 }
Exemplo n.º 5
0
 public void UpdateInfection(float infection)
 {
     if (m_infectionDisplay)
     {
         if (infection < 0.01f)
         {
             m_infectionDisplay.ToggleRendering(false);
         }
         else if (m_currentState == WatchState.Inventory)
         {
             m_infectionDisplay.ToggleRendering(true);
             m_infectionDisplay.UpdateFill((int)(infection * 100f));
             m_infectionDisplay.SetFill(infection);
             m_infectionDisplay.SetColor(Color.Lerp(m_normalInfectionCol, m_normalInfectionCol * 1.6f, infection));
         }
     }
 }