Пример #1
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (FixedEventSnippet)savedState;

            IsHappened = state.IsHappened;
            AutoReset  = state.AutoReset;
        }
Пример #2
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (ActiveInjurySnippet)savedState;

            Injury = (InjuryBase)Activator.CreateInstance(state.InjuryType);

            _injuryTriggerTimeInitial = state.InjuryTriggerTime;

            InjuryTriggerTime           = state.InjuryTriggerTime;
            IsDiseaseProbabilityChecked = state.IsDiseaseProbabilityChecked;
            BodyPart  = state.BodyPart;
            IsTreated = state.IsTreated;

            SetUpActiveStage(state.InjuryTriggerTime);

            Injury.RestoreState(state.ChildStates["Treatments"]);

            if (state.TreatedStageLevel.HasValue)
            {
                Invert();
            }
            else
            {
                TreatedStage = null;
            }

            _isChainInverted   = state.IsChainInverted;
            _isInjuryActivated = state.IsInjuryActivated;
        }
Пример #3
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (ActiveMedicalAgentsMonitorsSnippet)savedState;

            IsEpinephrineActive   = state.IsEpinephrineActive;
            IsAntiVenomActive     = state.IsAntiVenomActive;
            IsAtropineActive      = state.IsAtropineActive;
            IsMorphineActive      = state.IsMorphineActive;
            IsAntibioticActive    = state.IsAntibioticActive;
            IsAspirinActive       = state.IsAspirinActive;
            IsAcetaminophenActive = state.IsAcetaminophenActive;
            IsLoperamideActive    = state.IsLoperamideActive;
            IsOseltamivirActive   = state.IsOseltamivirActive;
            IsSedativeActive      = state.IsSedativeActive;
            IsDoripenemActive     = state.IsDoripenemActive;

            (_monitors[0] as ActiveMedicalAgent).RestoreState(state.ChildStates["EpinephrineMedicalAgent"]);
            (_monitors[1] as ActiveMedicalAgent).RestoreState(state.ChildStates["AntiVenomMedicalAgent"]);
            (_monitors[2] as ActiveMedicalAgent).RestoreState(state.ChildStates["AtropineMedicalAgent"]);
            (_monitors[3] as ActiveMedicalAgent).RestoreState(state.ChildStates["MorphineMedicalAgent"]);
            (_monitors[4] as ActiveMedicalAgent).RestoreState(state.ChildStates["AntibioticMedicalAgent"]);
            (_monitors[5] as ActiveMedicalAgent).RestoreState(state.ChildStates["AspirinMedicalAgent"]);
            (_monitors[6] as ActiveMedicalAgent).RestoreState(state.ChildStates["AcetaminophenMedicalAgent"]);
            (_monitors[7] as ActiveMedicalAgent).RestoreState(state.ChildStates["LoperamideMedicalAgent"]);
            (_monitors[8] as ActiveMedicalAgent).RestoreState(state.ChildStates["OseltamivirMedicalAgent"]);
            (_monitors[9] as ActiveMedicalAgent).RestoreState(state.ChildStates["SedativeMedicalAgent"]);
            (_monitors[10] as ActiveMedicalAgent).RestoreState(state.ChildStates["DoripenemMedicalAgent"]);
        }
Пример #4
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (HealthStateSnippet)savedState;

            BloodPressureTop         = state.BloodPressureTop;
            BloodPressureBottom      = state.BloodPressureBottom;
            HeartRate                = state.HeartRate;
            BloodPercentage          = state.BloodPercentage;
            FoodPercentage           = state.FoodPercentage;
            WaterPercentage          = state.WaterPercentage;
            OxygenPercentage         = state.OxygenPercentage;
            StaminaPercentage        = state.StaminaPercentage;
            FatiguePercentage        = state.FatiguePercentage;
            BodyTemperature          = state.BodyTemperature;
            LastSleepTime            = state.LastSleepTime;
            CheckTime                = state.CheckTime;
            IsBloodLoss              = state.IsBloodLoss;
            IsActiveInjury           = state.IsActiveInjury;
            IsActiveDisease          = state.IsActiveDisease;
            IsFoodDisgust            = state.IsFoodDisgust;
            IsSleepDisorder          = state.IsSleepDisorder;
            CannotRun                = state.CannotRun;
            IsLegFracture            = state.IsLegFracture;
            ActiveDiseasesWorstLevel = state.ActiveDiseasesWorstLevel;

            var diseasesAndInjuriesData = (ActiveDiseasesAndInjuriesSnippet)state.ChildStates["ActiveDiseasesAndInjuries"];

            CreateAndLinkActiveDiseasesAndInjuries(state.WorstDiseaseId, diseasesAndInjuriesData.ActiveDiseases, diseasesAndInjuriesData.ActiveInjuries);
        }
Пример #5
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (ActiveMedicalAgentSnippet)savedState;

            _gameMinutesAgentIsActive = state.GameMinutesAgentIsActive;
            _timesTaken = state.TimesTaken;
        }
Пример #6
0
        public override void RestoreState(IStateSnippet savedState)
        {
            var state = (InjuryTreatmentSnippet)savedState;

            _worryingStageTreatment.RestoreState(state.ToolsOnlyTreatments[0]);
            _criticalStageTreatment.RestoreState(state.ToolsOnlyTreatments[1]);
        }
Пример #7
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (ActiveDiseaseSnippet)savedState;

            Disease = (DiseaseDefinitionBase)Activator.CreateInstance(state.DiseaseType);

            _isDiseaseActivated = state.IsDiseaseActivated;
            _isSelfHealActive   = state.IsSelfHealActive;
            _diseaseStartTime   = state.DiseaseStartTime;

            IsTreated = state.IsTreated;

            ComputeDisease();

            if (state.TreatedStageLevel.HasValue)
            {
                Invert();
            }
            else
            {
                TreatedStage = null;
            }

            _isChainInverted = state.IsChainInverted;

            if (state.ChildStates["ChangedVitals"] != null)
            {
                var o = (ChangedVitalsInfoSnippet)state.ChildStates["ChangedVitals"];

                if (!o.IsEmpty)
                {
                    if (_changedVitals == null)
                    {
                        _changedVitals = new ChangedVitalsInfo();
                    }

                    _changedVitals.RestoreState(state.ChildStates["ChangedVitals"]);
                }
            }

            if (state.ChildStates["ChangedCritialStage"] != null)
            {
                var o = (ChangedVitalsInfoSnippet)state.ChildStates["ChangedCritialStage"];

                if (!o.IsEmpty)
                {
                    if (_changedCritialStage == null)
                    {
                        _changedCritialStage = new ChangedVitalsInfo();
                    }

                    _changedCritialStage.RestoreState(state.ChildStates["ChangedCritialStage"]);
                }
            }

            Disease.RestoreState(state.ChildStates["Treatments"]);

            Refresh(_gc.WorldTime.Value);
        }
Пример #8
0
        public override void RestoreState(IStateSnippet savedState)
        {
            var state = (InventoryFoodItemSnippet)savedState;

            Count     = state.Count;
            IsSpoiled = state.IsSpoiled;
            FoodItemsGatheringInfo = state.FoodItemsGatheringInfo;
        }
Пример #9
0
        public override void RestoreState(IStateSnippet savedState)
        {
            var state = (DiseaseTreatmentSnippet)savedState;

            _progressingStageTreatment.RestoreState(state.ApplianceTimedTreatmentNodes[0]);
            _worryingStageTreatment.RestoreState(state.ApplianceTimedTreatmentNodes[1]);
            _criticalingStageTreatment.RestoreState(state.ApplianceTimedTreatmentNodes[2]);
        }
Пример #10
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (FatigueHealthEffectsSnippet)savedState;

            BloodPressureBottomBonus = state.BloodPressureBottomBonus;
            BloodPressureTopBonus    = state.BloodPressureTopBonus;
            HeartRateBonus           = state.HeartRateBonus;
        }
Пример #11
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (WetnessControllerSnippet)savedState;

            IsWet = state.IsWet;

            _wetnessValue       = state.WetnessValue;
            _lastGettingWetTime = state.LastGettingWetTime;
        }
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (MedicalAgentsHealthEffectsSnippet)savedState;

            BloodPressureBottomBonus = state.BloodPressureBottomBonus;
            BloodPressureTopBonus    = state.BloodPressureTopBonus;
            HeartRateBonus           = state.HeartRateBonus;
            BodyTemperatureBonus     = state.BodyTemperatureBonus;
        }
Пример #13
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (HypothermiaMonitorSnippet)savedState;

            _nextCheckTime      = state.NextCheckTime;
            _isDiseaseActivated = state.IsDiseaseActivated;
            _currentHypothermiaWarmthLevelThreshold = state.CurrentHypothermiaWarmthLevelThreshold;

            _hypothermiaDeathEvent.RestoreState(state.ChildStates["HypothermiaDeathEvent"]);
        }
Пример #14
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (DiseaseMonitorsSnippet)savedState;

            (_monitors[0] as AnginaMonitor).RestoreState(state.ChildStates["AnginaMonitor"]);
            (_monitors[1] as FluMonitor).RestoreState(state.ChildStates["FluMonitor"]);
            (_monitors[2] as HyperthermiaMonitor).RestoreState(state.ChildStates["HyperthermiaMonitor"]);
            (_monitors[3] as HypothermiaMonitor).RestoreState(state.ChildStates["HypothermiaMonitor"]);
            (_monitors[4] as FoodPoisoningMonitor).RestoreState(state.ChildStates["FoodPoisoningMonitor"]);
        }
Пример #15
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (EventByChanceSnippet)savedState;

            _chanceOfHappening = state.ChanceOfHappening;
            _coundownTimer     = state.CoundownTimer;

            IsHappened = state.IsHappened;
            AutoReset  = state.AutoReset;
        }
Пример #16
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (InventoryHealthEffectsSnippet)savedState;

            PlayerRunSpeedBonus    = state.PlayerRunSpeedBonus;
            PlayerWalkSpeedBonus   = state.PlayerWalkSpeedBonus;
            PlayerCrouchSpeedBonus = state.PlayerCrouchSpeedBonus;
            IsFreezed = state.IsFreezed;

            _freezedByInventoryOverloadEvent.RestoreState(state.ChildStates["FreezedByInventoryOverloadEvent"]);
        }
Пример #17
0
        public override void RestoreState(IStateSnippet savedState)
        {
            var state = (InventoryWaterVesselItemSnippet)savedState;

            Count             = state.Count;
            DosesLeft         = state.DosesLeft;
            IsSafe            = state.IsSafe;
            LastBoilTime      = state.LastBoilTime;
            LastDisinfectTime = state.LastDisinfectTime;
            LastFillTime      = state.LastFillTime;
        }
Пример #18
0
            public void RestoreState(IStateSnippet savedState)
            {
                var state = (ChangedVitalsInfoSnippet)savedState;

                Level                      = state.Level;
                InitialHeartRate           = state.InitialHeartRate;
                InitialBloodPressureTop    = state.InitialBloodPressureTop;
                InitialBloodPressureBottom = state.InitialBloodPressureBottom;
                InitialBodyTemperature     = state.InitialBodyTemperature;
                InitialStageDuration       = state.InitialStageDuration;
            }
Пример #19
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (ToolsOnlyInjuryTreatmentSnippet)savedState;

            _lastToolTime = state.LastToolTime;
            _toolsNeeded  = _toolsOriginal.ToList();

            for (int i = 0; i < state.ToolsUsed; i++)
            {
                _toolsNeeded.RemoveAt(0);
            }
        }
Пример #20
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (ApplianceTimedTreatmentNodeSnippet)savedState;

            _isOverallHealingStarted = state.IsOverallHealingStarted;

            // For the node instance, treatments count cannot change
            for (int i = 0; i < _treatments.Count; i++)
            {
                _treatments[i].RestoreState(state.List[i]);
            }
        }
Пример #21
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (ApplianceTimedTreatmentSnippet)savedState;

            IsNodePart = this.IsNodePart;
            IsFailed   = this.IsFailed;
            IsFinished = this.IsFinished;
            IsStarted  = this.IsStarted;

            _consumedTimes.Clear();
            _consumedTimes.AddRange(state.ConsumedTimes);
            _inTimeConsumedCount = state.InTimeConsumedCount;
        }
Пример #22
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (UnderwaterHealthEffectsSnippet)savedState;

            BloodPressureBottomBonus = state.BloodPressureBottomBonus;
            BloodPressureTopBonus    = state.BloodPressureTopBonus;
            HeartRateBonus           = state.HeartRateBonus;
            OxygenLevelBonus         = state.OxygenLevelBonus;

            _lastUnderWaterState   = state.LastUnderWaterState;
            _gameTimeGotUnderwater = state.GameTimeGotUnderwater;

            _drowningDeathEvent.RestoreState(state.ChildStates["DrowningDeathEvent"]);
        }
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (ClothesHealthEffectsSnippet)savedState;

            BodyTemperatureBonus = state.BodyTemperatureBonus;
            HeartRateBonus       = state.HeartRateBonus;
            PlayerRunSpeedBonus  = state.PlayerRunSpeedBonus;
            StaminaBonus         = state.StaminaBonus;

            _currentHeartRateBonus      = state.CurrentHeartRateBonus;
            _currentTemperatureBonus    = state.CurrentTemperatureBonus;
            _lastAutoReLerpTime         = state.LastAutoReLerpTime;
            _lastClothesChangeTime      = state.LastClothesChangeTime;
            _targetBodyTemperatureDelta = state.TargetBodyTemperatureDelta;
            _targetHeartRateDelta       = state.TargetHeartRateDelta;
        }
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (RunningHealthEffectsSnippet)savedState;

            BloodPressureBottomBonus = state.BloodPressureBottomBonus;
            BloodPressureTopBonus    = state.BloodPressureTopBonus;
            HeartRateBonus           = state.HeartRateBonus;
            OxygenLevelBonus         = state.OxygenLevelBonus;
            BodyTemperatureBonus     = state.BodyTemperatureBonus;

            _gameSecondsInRunningState = state.GameSecondsInRunningState;
            _isWheezeEventTriggered    = state.IsWheezeEventTriggered;

            _intenseRunningOnEvent.RestoreState(state.ChildStates["IntenseRunningOnEvent"]);
            _intenseRunningOffEvent.RestoreState(state.ChildStates["IntenseRunningOffEvent"]);
        }
Пример #25
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (PlayerControllerStateSnippet)savedState;

            _warmthLevelTimeoutCounter  = state.WarmthLevelTimeoutCounter;
            _wetnessLevelTimeoutCounter = state.WetnessLevelTimeoutCounter;
            _warmthLerpTarget           = state.WarmthLerpTarget;
            _warmthLerpCounter          = state.WarmthLerpCounter;
            _warmthLerpBase             = state.WarmthLerpBase;
            _sleepingCounter            = state.SleepingCounter;
            _sleepDurationGameHours     = state.SleepDurationGameHours;
            _sleepHealthCheckPeriod     = state.SleepHealthCheckPeriod;
            _sleepHealthChecksLeft      = state.SleepHealthChecksLeft;
            _sleepStartTime             = state.SleepStartTime;
            _fatigueValueAfterSleep     = state.FatigueValueAfterSleep;

            _wetnessController.RestoreState((WetnessControllerSnippet)state.ChildStates["WetnessController"]);

            Clothes.Clear();

            foreach (var clothesItem in state.Clothes)
            {
                var newId = state.InventoryData.ItemsMapping.ContainsKey(clothesItem) ? state.InventoryData.ItemsMapping[clothesItem] : (Guid?)null;
                var item  = newId.HasValue ? _gc.Inventory.Items.FirstOrDefault(x => x.Id == newId.Value) : null;

                if (item as ClothesItemBase != null)
                {
                    Clothes.Add((ClothesItemBase)item);
                }
            }

            Appliances.Clear();

            foreach (var applianceItem in state.Appliances)
            {
                var newId = state.InventoryData.ItemsMapping.ContainsKey(applianceItem.ItemId) ? state.InventoryData.ItemsMapping[applianceItem.ItemId] : (Guid?)null;
                var item  = newId.HasValue ? _gc.Inventory.Items.FirstOrDefault(x => x.Id == newId.Value) : null;

                if (item as InventoryMedicalItemBase != null)
                {
                    Appliances.Add(new MedicalBodyAppliance {
                        BodyPart = applianceItem.BodyPart,
                        Item     = (InventoryMedicalItemBase)item
                    });
                }
            }
        }
Пример #26
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (InventoryControllerStateSnippet)savedState;

            RoughWeight = state.RoughWeight;

            Items.Clear();

            var mapping = new Dictionary <Guid, Guid>(); //old id, new id

            foreach (var itemData in state.GenericInventoryItems)
            {
                var newItem = (InventoryItemBase)Activator.CreateInstance(itemData.ItemType);

                newItem.RestoreState(itemData);

                mapping.Add(itemData.Id, newItem.Id);

                Items.Add(newItem);
            }

            foreach (var itemData in state.FoodInventoryItems)
            {
                var newItem = (InventoryItemBase)Activator.CreateInstance(itemData.ItemType);

                newItem.RestoreState(itemData);

                mapping.Add(itemData.Id, newItem.Id);

                Items.Add(newItem);
            }

            foreach (var itemData in state.WaterInventoryItems)
            {
                var newItem = (InventoryItemBase)Activator.CreateInstance(itemData.ItemType);

                newItem.RestoreState(itemData);

                mapping.Add(itemData.Id, newItem.Id);

                Items.Add(newItem);
            }

            state.SetItemsMapping(mapping);

            RebuildCache();
        }
Пример #27
0
        public virtual void RestoreState(IStateSnippet savedState)
        {
            var state = (InventoryItemSnippet)savedState;

            Count = state.Count;
        }
Пример #28
0
 public override void RestoreState(IStateSnippet savedState)
 {
 }
Пример #29
0
        public override void RestoreState(IStateSnippet savedState)
        {
            var state = (DiseaseTreatmentSnippet)savedState;

            //...
        }
Пример #30
0
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (FoodPoisoningMonitorSnippet)savedState;

            //...
        }