Пример #1
0
        internal static void FeedFire(Panel_FeedFire __instance)
        {
            Fire     _fire = __instance.m_Fire;
            string   guid  = Utils.GetGuidFromGameObject(_fire.gameObject);
            GearItem fuel  = __instance.GetSelectedFuelSource();

            // cool off fire with water
            if (fuel.name.ToLower().Contains("recycledcan") || fuel.name.ToLower().Contains("cookingpot"))
            {
                GearItem gi_wt = GameManager.GetInventoryComponent().GetPotableWaterSupply();
                if (gi_wt.m_WaterSupply.m_VolumeInLiters >= 0.25f && _fire.m_HeatSource.m_MaxTempIncrease > Settings.options.waterTempRemoveDeg)
                {
                    GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter());
                    GameAudioManager.PlaySound(gi_wt.m_PickUpAudio, InterfaceManager.GetSoundEmitter());
                    gi_wt.m_WaterSupply.m_VolumeInLiters -= 0.25f;
                    _fire.ReduceHeatByDegrees(Settings.options.waterTempRemoveDeg);
                }
                else if (gi_wt.m_WaterSupply.m_VolumeInLiters < 0.25f)
                {
                    HUDMessage.AddMessage("Need water in inventory.", false);
                    GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter());
                    GameAudioManager.PlayGUIError();
                }
                else
                {
                    HUDMessage.AddMessage("Temperature is too low.", false);
                    GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter());
                    GameAudioManager.PlayGUIError();
                }

                /* we consume can/pot so recreate it
                 * we could hack it to not consume but after some time (minutes) of feed fire dialog, said object is getting corrupted in such way that it's lagging game
                 * on each interaction with said item
                 */
                GearItem clone = Utils.InstantiateGearFromPrefabName(fuel.name);
                clone.m_CurrentHP = fuel.m_CurrentHP;
                GameManager.GetInventoryComponent().AddGear(clone.gameObject);
                GameManager.GetInventoryComponent().DestroyGear(fuel.gameObject);
            }
            // added fuel while embers
            else if (_fire.m_EmberTimer > 0f)
            {
                ResetEmbersOnRestart(_fire);
            }
            // try add fuel to embers unless it wasn't comming out from ember state.
            else if (fuel.name.ToLower().Contains("wood") || fuel.name.ToLower().Contains("coal"))
            {
                if (_fire.GetRemainingLifeTimeSeconds() < 39600 && (_fire.m_EmberDurationSecondsTOD < (Settings.options.embersTime * 3600)))
                {
                    float fuelmove = fuel.m_FuelSourceItem.m_BurnDurationHours * Settings.options.embersFuelRatio;
                    _fire.m_MaxOnTODSeconds         -= fuelmove * 3600;
                    _fire.m_EmberDurationSecondsTOD += (fuelmove * 3600) * Settings.options.embersFuelEx;
                    _fire.m_BurningTimeTODHours     -= fuelmove;
                }
            }
        }
Пример #2
0
        public void OnDisable()
        {
            if (this.gameObject.activeInHierarchy)
            {
                return;
            }

            EmitterProxy[] emitterProxies = this.gameObject.GetComponentsInChildren <EmitterProxy>();
            foreach (var eachEmitterProxy in emitterProxies)
            {
                GameAudioManager.StopAllSoundsFromGameObject(eachEmitterProxy.m_Proxy);
            }
        }