Пример #1
0
        public static void AdjustWaterToWaterSupply()
        {
            var potableWaterSupply = GameManager.GetInventoryComponent().GetPotableWaterSupply().m_WaterSupply;
            var potableDelta       = potableWaterSupply.m_VolumeInLiters - WATER.ActualPotable;

            var nonPotableWaterSupply = GameManager.GetInventoryComponent().GetNonPotableWaterSupply().m_WaterSupply;
            var nonPotableDelta       = nonPotableWaterSupply.m_VolumeInLiters - WATER.ActualNonPotable;

            WATER.Remove(-nonPotableDelta, LiquidQuality.NonPotable);
            WATER.Remove(-potableDelta, LiquidQuality.Potable);
            WATER.Add(potableDelta, LiquidQuality.Potable);
            WATER.Add(nonPotableDelta, LiquidQuality.NonPotable);

            WATER.UpdateAmounts();
            WATER.UpdateBottles();

            float potableWaterLost = potableWaterSupply.m_VolumeInLiters - WATER.ActualPotable;

            potableWaterSupply.m_VolumeInLiters = WATER.ActualPotable;
            if (!IsNone(potableWaterLost))
            {
                GearMessage.AddMessage(
                    potableWaterSupply.name,
                    Localization.Get("GAMEPLAY_Lost"),
                    " " + Localization.Get("GAMEPLAY_WaterPotable") + " (" + Utils.GetLiquidQuantityStringWithUnitsNoOunces(InterfaceManager.m_Panel_OptionsMenu.m_State.m_Units, potableWaterLost) + ")",
                    Color.red,
                    false);
            }

            float nonPotableWaterLost = nonPotableWaterSupply.m_VolumeInLiters - WATER.ActualNonPotable;

            nonPotableWaterSupply.m_VolumeInLiters = WATER.ActualNonPotable;
            if (!IsNone(nonPotableWaterLost))
            {
                GearMessage.AddMessage(
                    nonPotableWaterSupply.name,
                    Localization.Get("GAMEPLAY_Lost"),
                    " " + Localization.Get("GAMEPLAY_WaterUnsafe") + " (" + Utils.GetLiquidQuantityStringWithUnitsNoOunces(InterfaceManager.m_Panel_OptionsMenu.m_State.m_Units, nonPotableWaterLost) + ")",
                    Color.red,
                    false);
            }
        }
Пример #2
0
        public static void AdjustWaterToWaterSupply()
        {
            if (IgnoreChanges)
            {
                return;
            }

            var potableWaterSupply = GameManager.GetInventoryComponent().GetPotableWaterSupply().m_WaterSupply;
            var potableDelta       = potableWaterSupply.m_VolumeInLiters - WATER.ActualPotable;       //the change in potable water held by the player

            var nonPotableWaterSupply = GameManager.GetInventoryComponent().GetNonPotableWaterSupply().m_WaterSupply;
            var nonPotableDelta       = nonPotableWaterSupply.m_VolumeInLiters - WATER.ActualNonPotable;       //the change in nonpotable water held by the player

            //Does nothing if potableDelta and nonPotableDelta are positive
            WATER.Remove(-nonPotableDelta, LiquidQuality.NonPotable);
            WATER.Remove(-potableDelta, LiquidQuality.Potable);
            //Does nothing if potableDelta and nonPotableDelta are negative
            WATER.Add(potableDelta, LiquidQuality.Potable);
            WATER.Add(nonPotableDelta, LiquidQuality.NonPotable);

            WATER.UpdateAmounts();                                                              //Recalculates the total amounts of water held and the total capacities for each type
            WATER.UpdateBottles();                                                              //Updates the sound and texture of each water bottle in the inventory

            float potableWaterLost = potableWaterSupply.m_VolumeInLiters - WATER.ActualPotable; //This water could not be added due to lack of space. It is lost.

            potableWaterSupply.m_VolumeInLiters = WATER.ActualPotable;
            if (!IsNone(potableWaterLost))
            {
                SendDelayedLostMessage(potableWaterSupply, "GAMEPLAY_WaterPotable", potableWaterLost);
            }

            float nonPotableWaterLost = nonPotableWaterSupply.m_VolumeInLiters - WATER.ActualNonPotable;             //This water could not be added due to lack of space. It is lost.

            nonPotableWaterSupply.m_VolumeInLiters = WATER.ActualNonPotable;
            if (!IsNone(nonPotableWaterLost))
            {
                SendDelayedLostMessage(nonPotableWaterSupply, "GAMEPLAY_WaterUnsafe", nonPotableWaterLost);
            }
        }
Пример #3
0
        public static void AdjustWaterToWaterSupply()
        {
            if (IgnoreChanges)
            {
                return;
            }

            var potableWaterSupply = GameManager.GetInventoryComponent().GetPotableWaterSupply().m_WaterSupply;
            var potableDelta       = potableWaterSupply.m_VolumeInLiters - WATER.ActualPotable;

            var nonPotableWaterSupply = GameManager.GetInventoryComponent().GetNonPotableWaterSupply().m_WaterSupply;
            var nonPotableDelta       = nonPotableWaterSupply.m_VolumeInLiters - WATER.ActualNonPotable;

            WATER.Remove(-nonPotableDelta, LiquidQuality.NonPotable);
            WATER.Remove(-potableDelta, LiquidQuality.Potable);
            WATER.Add(potableDelta, LiquidQuality.Potable);
            WATER.Add(nonPotableDelta, LiquidQuality.NonPotable);

            WATER.UpdateAmounts();
            WATER.UpdateBottles();

            float potableWaterLost = potableWaterSupply.m_VolumeInLiters - WATER.ActualPotable;

            potableWaterSupply.m_VolumeInLiters = WATER.ActualPotable;
            if (!IsNone(potableWaterLost))
            {
                SendDelayedLostMessage(potableWaterSupply, "GAMEPLAY_WaterPotable", potableWaterLost);
            }

            float nonPotableWaterLost = nonPotableWaterSupply.m_VolumeInLiters - WATER.ActualNonPotable;

            nonPotableWaterSupply.m_VolumeInLiters = WATER.ActualNonPotable;
            if (!IsNone(nonPotableWaterLost))
            {
                SendDelayedLostMessage(nonPotableWaterSupply, "GAMEPLAY_WaterUnsafe", nonPotableWaterLost);
            }
        }