예제 #1
0
    public override void Update()
    {
        base.Update();
        float currentTimeMinutes = MainLevel.Instance.GetCurrentTimeMinutes();

        if (currentTimeMinutes < SleepController.Get().m_LastWakeUpTimeLogical + this.m_NoSleepTmeToActivate)
        {
            this.m_Level         = 0;
            this.m_InsomniaLevel = 0f;
            this.Deactivate();
            return;
        }
        this.m_InsomniaLevel = (currentTimeMinutes - (SleepController.Get().m_LastWakeUpTimeLogical + this.m_NoSleepTmeToActivate)) / this.m_NoSleepTimeToIncreaseLevel;
        if (this.m_InsomniaLevel >= 5.9999f)
        {
            SleepController.Get().m_LastWakeUpTimeLogical  = MainLevel.Instance.GetCurrentTimeMinutes();
            SleepController.Get().m_LastWakeUpTimeLogical -= this.m_NoSleepTmeToActivate;
            SleepController.Get().m_LastWakeUpTimeLogical -= this.m_NoSleepTimeToIncreaseLevel * 5.9999f;
        }
        if (this.m_InsomniaLevel <= -0.0001f)
        {
            SleepController.Get().m_LastWakeUpTimeLogical = MainLevel.Instance.GetCurrentTimeMinutes();
        }
        this.m_InsomniaLevel = Mathf.Clamp(this.m_InsomniaLevel, -0.0001f, 5.9999f);
        this.m_Level         = (int)Mathf.Ceil(this.m_InsomniaLevel);
        this.m_Level         = Mathf.Clamp(this.m_Level, 1, 6);
        if (MainLevel.s_GameTime - this.m_LastSanityDecreaseTime >= this.m_SanityDecreaseInterval && (!SleepController.Get().IsActive() || SleepController.Get().IsWakingUp()))
        {
            PlayerSanityModule.Get().OnEvent(PlayerSanityModule.SanityEventType.Insomnia, this.m_SanityDecreaseVal * this.m_Level);
            this.m_LastSanityDecreaseTime = MainLevel.s_GameTime;
        }
    }
예제 #2
0
 public void OnWakeUpButton()
 {
     if (!Player.Get().IsDead())
     {
         SleepController.Get().WakeUp(false, true);
     }
 }
예제 #3
0
    private void UpdateSpoiling()
    {
        if (this.m_SpoilTime <= 0f)
        {
            this.m_SpoilingDuration = 0f;
            return;
        }
        if (base.transform.parent)
        {
            this.m_SpoilingDuration = 0f;
            return;
        }
        if (this.m_LCInfo.m_Amount == 0f || this.m_LCInfo.m_LiquidType != LiquidType.Water)
        {
            this.m_SpoilingDuration = 0f;
            return;
        }
        float num = Time.deltaTime;

        if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
        {
            num = Player.GetSleepTimeFactor();
        }
        this.m_SpoilingDuration += num;
        if (this.m_SpoilingDuration >= this.m_SpoilTime)
        {
            this.m_LCInfo.m_LiquidType = LiquidType.UnsafeWater;
            this.m_SpoilingDuration    = 0f;
        }
    }
예제 #4
0
 public static void SetupObjects()
 {
     SaveGame.m_Objects.Clear();
     SaveGame.m_Objects.Add(DifficultySettings.Get());
     SaveGame.m_Objects.Add(DialogsManager.Get());
     SaveGame.m_Objects.Add(AIManager.Get());
     SaveGame.m_Objects.Add(EnemyAISpawnManager.Get());
     SaveGame.m_Objects.Add(TriggersManager.Get());
     SaveGame.m_Objects.Add(ItemsManager.Get());
     SaveGame.m_Objects.Add(SensorManager.Get());
     SaveGame.m_Objects.Add(ConstructionGhostManager.Get());
     SaveGame.m_Objects.Add(StaticObjectsManager.Get());
     SaveGame.m_Objects.Add(Player.Get());
     SaveGame.m_Objects.Add(PlayerConditionModule.Get());
     SaveGame.m_Objects.Add(PlayerInjuryModule.Get());
     SaveGame.m_Objects.Add(PlayerDiseasesModule.Get());
     SaveGame.m_Objects.Add(StatsManager.Get());
     SaveGame.m_Objects.Add(HintsManager.Get());
     SaveGame.m_Objects.Add(ObjectivesManager.Get());
     SaveGame.m_Objects.Add(StoryObjectivesManager.Get());
     SaveGame.m_Objects.Add(HUDObjectives.Get());
     SaveGame.m_Objects.Add(MenuNotepad.Get());
     SaveGame.m_Objects.Add(MapTab.Get());
     SaveGame.m_Objects.Add(Music.Get());
     SaveGame.m_Objects.Add(RainManager.Get());
     SaveGame.m_Objects.Add(SleepController.Get());
     SaveGame.m_Objects.Add(MainLevel.Instance);
     SaveGame.m_Objects.Add(ScenarioManager.Get());
     SaveGame.m_Objects.Add(InventoryBackpack.Get());
     SaveGame.m_Objects.Add(ReplicatedSessionState.Get());
 }
예제 #5
0
    public static void StartSleep(PESleep peSleep, PeEntity character, float hours = 12)
    {
        if (null != character)
        {
            SleepController sc = character.GetComponent <SleepController>();
            if (sc == null)
            {
                sc = character.gameObject.AddComponent <SleepController>();
                sc.isMainPlayer = Pathea.PeCreature.Instance.mainPlayer == character;

                if (sc.isMainPlayer)
                {
                    MotionMgrCmpt mmc         = character.GetCmpt <MotionMgrCmpt>();
                    Action_Sleep  actionSleep = mmc.GetAction <Action_Sleep>();
                    actionSleep.startSleepEvt += sc.MainPlayerStartSleep;
                    actionSleep.startSleepEvt += (i) => FastTravelMgr.Instance.Add(sc);
                    actionSleep.endSleepEvt   += sc.MainPlayerEndSleep;
                    actionSleep.endSleepEvt   += (i) => FastTravelMgr.Instance.Remove(sc);
                }
            }

            sc.character    = character.GetComponent <OperateCmpt>();
            sc.maxSleepTime = hours * 3600f;
            sc.timeCount    = 0;
            sc.peSleep      = peSleep;
            sc.enabled      = true;
            sc.actionTime   = 2f;
            peSleep.StartOperate(sc.character, EOperationMask.Sleep);
//			peSleep.Do(sc.character);
        }
    }
예제 #6
0
    private void SetupSelections()
    {
        Color color = this.m_Buttons[0].m_Icon.color;

        color.a = ((!Player.Get().CanStartCrafting()) ? this.m_InactiveAlpha : (CraftingManager.Get().gameObject.activeSelf ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[0].m_Icon.color = color;
        color   = this.m_Buttons[3].m_Icon.color;
        color.a = ((!Player.Get().CanShowNotepad()) ? this.m_InactiveAlpha : (NotepadController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[3].m_Icon.color = color;
        color   = this.m_Buttons[4].m_Icon.color;
        color.a = (Inventory3DManager.Get().gameObject.activeSelf ? this.m_SelectedAlpha : this.m_NormalAlpha);
        this.m_Buttons[4].m_Icon.color = color;
        color   = this.m_Buttons[5].m_Icon.color;
        color.a = ((!Player.Get().CanStartBodyInspection()) ? this.m_InactiveAlpha : (BodyInspectionController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[5].m_Icon.color = color;
        color   = this.m_Buttons[1].m_Icon.color;
        color.a = ((!Player.Get().CanStartCrafting()) ? this.m_InactiveAlpha : (CraftingManager.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[1].m_Icon.color = color;
        color   = this.m_Buttons[0].m_Icon.color;
        color.a = ((!Player.Get().CanShowMap()) ? this.m_InactiveAlpha : (MapController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[0].m_Icon.color = color;
        color   = this.m_Buttons[2].m_Icon.color;
        color.a = ((!Player.Get().CanSleep()) ? this.m_InactiveAlpha : (SleepController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[2].m_Icon.color = color;
    }
예제 #7
0
 public override void ConstantUpdate()
 {
     base.ConstantUpdate();
     if (this.m_State == CharcoalFurnace.State.Burning)
     {
         float num = Time.deltaTime;
         if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
         {
             num = Player.GetSleepTimeFactor();
         }
         this.m_BurningDuration += num;
         if (this.m_BurningDuration >= this.m_BurningLength)
         {
             this.SetState(CharcoalFurnace.State.DestroyDoor, false);
         }
     }
     else if (this.m_State == CharcoalFurnace.State.Ready && this.m_Stand.m_NumItems == 0)
     {
         this.SetState(CharcoalFurnace.State.WaitingForWood, false);
     }
     if (this.m_DoorLOD1.activeSelf != this.m_Door.gameObject.activeSelf)
     {
         this.m_DoorLOD1.SetActive(this.m_Door.gameObject.activeSelf);
     }
 }
예제 #8
0
    void OnOkBtn()
    {
        //		if (DoSleep)//mDoSleep != null
        //        {
        //			mDoSleep((int)(((int)11 * mSleepSlider.scrollValue) + 1));
        //			ShowSleepWnd(false);
        //		}
        //		else
        //			Hide();
        if (m_PeSleep == null || mEntity == null)
        {
            return;
        }

        if (!m_PeSleep.CanOperateMask(Pathea.Operate.EOperationMask.Sleep))
        {
            return;
        }

        Pathea.MotionMgrCmpt mmc = mEntity.GetCmpt <Pathea.MotionMgrCmpt>();

        if (null != mmc && (mmc.IsActionRunning(Pathea.PEActionType.Sleep) || !mmc.CanDoAction(Pathea.PEActionType.Sleep)))
        {
            return;
        }

        SleepController.StartSleep(m_PeSleep, mEntity, GetCurSleepTime());
        ShowSleepWnd(false);
    }
예제 #9
0
 public override void OnExecute(TriggerAction.TYPE action)
 {
     base.OnExecute(action);
     if (!GreenHellGame.ROADSHOW_DEMO && action == TriggerAction.TYPE.Sleep)
     {
         SleepController.Get().StartSleeping(this, true);
     }
 }
예제 #10
0
    public override void ConstantUpdate()
    {
        base.ConstantUpdate();
        float num  = Time.deltaTime;
        bool  flag = this.GetProcessProgress(this) < 1f;

        if (this.m_CharcoalSlot.gameObject.activeSelf != flag)
        {
            this.m_CharcoalSlot.gameObject.SetActive(flag);
        }
        if (this.m_Burning)
        {
            if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
            {
                num = Player.GetSleepTimeFactor();
            }
            this.m_BurningDuration += num;
            if (this.m_BurningDuration >= this.m_BurningLength)
            {
                this.m_BurningDuration = this.m_BurningLength;
                this.Extinguish();
            }
        }
        if (this.m_Burning)
        {
            Forge.State state = this.m_State;
            if (state != Forge.State.MakingOre)
            {
                if (state == Forge.State.MakingForm)
                {
                    if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
                    {
                        num = Player.GetSleepTimeFactor();
                    }
                    this.m_ForgingDuration += num;
                    if (this.m_ForgingDuration >= this.m_MakingFormLength)
                    {
                        this.SetState(Forge.State.Form);
                        return;
                    }
                }
            }
            else
            {
                if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
                {
                    num = Player.GetSleepTimeFactor();
                }
                this.m_ForgingDuration += num;
                if (this.m_ForgingDuration >= this.m_MakingOreLength)
                {
                    this.SetState(Forge.State.Ore);
                }
            }
        }
    }
예제 #11
0
    public void OnInsomniaHealButton()
    {
        Insomnia insomnia = (Insomnia)PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.Insomnia);

        if (insomnia != null)
        {
            insomnia.m_InsomniaLevel = 0f;
            SleepController.Get().m_LastWakeUpTimeLogical = MainLevel.Instance.GetCurrentTimeMinutes();
        }
    }
예제 #12
0
    public void SleepImmediately(PESleep peSleep, Pathea.PeEntity character)
    {
        if (!mInit)
        {
            InitWindow();
        }

        mMainWnd.SetActive(false);
        SleepController.StartSleep(peSleep, Pathea.MainPlayer.Instance.entity, SleepTime.NormalHours);
    }
예제 #13
0
    public override void ConstantUpdate()
    {
        base.ConstantUpdate();
        float delta_time = Time.deltaTime;

        if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
        {
            delta_time = Player.GetSleepTimeFactor();
        }
        this.UpdateProcessing(delta_time);
        this.UpdateParticles();
    }
예제 #14
0
    public override void ConstantUpdate()
    {
        base.ConstantUpdate();
        float delta_time = Time.deltaTime;

        if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
        {
            delta_time = Player.GetSleepTimeFactor();
        }
        this.UpdateWaterFromRain(delta_time);
        this.UpdateFiltering(delta_time);
    }
예제 #15
0
    protected override bool ShouldShow()
    {
        if (GreenHellGame.Instance.m_GameMode != GameMode.Story)
        {
            return(false);
        }
        if (ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding"))
        {
            return(false);
        }
        if (ChallengesManager.Get() && ChallengesManager.Get().IsChallengeActive())
        {
            return(false);
        }
        if (ConsciousnessController.Get().IsActive())
        {
            return(false);
        }
        if (SleepController.Get().IsActive())
        {
            return(false);
        }
        if (HUDReadableItem.Get().enabled)
        {
            return(false);
        }
        if (Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash))
        {
            return(false);
        }
        if (Time.time - SwimController.Get().m_LastDisableTime < 0.5f)
        {
            return(false);
        }
        if (Player.Get().m_IsInAir)
        {
            return(false);
        }
        if (HUDWheel.Get().enabled)
        {
            return(false);
        }
        if (FPPController.Get().m_Dodge)
        {
            return(false);
        }
        int shortNameHash = Player.Get().m_Animator.GetCurrentAnimatorStateInfo(1).shortNameHash;

        return(shortNameHash != this.m_MapWatchHideHash && shortNameHash != this.m_MapWatchIdleHash && shortNameHash != this.m_MapWatchShowHash && shortNameHash != this.m_MapZoomHash && shortNameHash != this.m_MapHideHash && shortNameHash != this.m_MapIdleHash && shortNameHash != this.m_ShowMapHash && (!DeathController.Get().IsActive() && !InsectsController.Get().IsActive() && !ScenarioManager.Get().IsDreamOrPreDream() && !Inventory3DManager.Get().IsActive() && !CutscenesManager.Get().IsCutscenePlaying() && !SwimController.Get().IsActive() && !BodyInspectionController.Get().IsActive() && !HarvestingAnimalController.Get().IsActive() && !HarvestingSmallAnimalController.Get().IsActive() && !VomitingController.Get().IsActive() && !MapController.Get().IsActive() && !NotepadController.Get().IsActive() && !MudMixerController.Get().IsActive()) && !MakeFireController.Get().IsActive());
    }
예제 #16
0
    public void OnInsomniaButton()
    {
        Insomnia insomnia = (Insomnia)PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.Insomnia);

        if (insomnia != null)
        {
            if (insomnia.m_InsomniaLevel <= 0f)
            {
                SleepController.Get().m_LastWakeUpTimeLogical -= insomnia.m_NoSleepTmeToActivate;
                return;
            }
            SleepController.Get().m_LastWakeUpTimeLogical -= insomnia.m_NoSleepTimeToIncreaseLevel;
        }
    }
예제 #17
0
 public override void Update()
 {
     base.Update();
     if (MainLevel.Instance.m_TODSky.IsDay)
     {
         float num = Time.deltaTime;
         if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
         {
             num = Player.GetSleepTimeFactor();
         }
         this.m_BatteryLevel += this.m_BatteryRestorePerSec * num;
     }
     this.m_BatteryLevel = Mathf.Clamp01(this.m_BatteryLevel);
 }
예제 #18
0
    public override void Init(IModule module)
    {
        base.Init(module);

        var viewScript = InstantiateView <SleepAudioListView>("Sleep/Prefabs/SleepAudioListView");

        _controller = new SleepController {
            AudioListView = viewScript
        };
        RegisterView(viewScript);
        RegisterController(_controller);
        RegisterModel <SleepModel>();
        _controller.Start();
    }
예제 #19
0
    public void OnInsomniaDecreaseButton()
    {
        Insomnia insomnia = (Insomnia)PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.Insomnia);

        if (insomnia != null)
        {
            if (insomnia.m_InsomniaLevel < 1f)
            {
                this.OnInsomniaHealButton();
                return;
            }
            SleepController.Get().m_LastWakeUpTimeLogical += insomnia.m_NoSleepTimeToIncreaseLevel;
            SleepController.Get().m_LastWakeUpTimeLogical  = System.Math.Min(MainLevel.Instance.GetCurrentTimeMinutes(), SleepController.Get().m_LastWakeUpTimeLogical);
        }
    }
예제 #20
0
 public static void SetupObjectsCoop()
 {
     SaveGame.m_Objects.Clear();
     SaveGame.m_Objects.Add(ItemsManager.Get());
     SaveGame.m_Objects.Add(Player.Get());
     SaveGame.m_Objects.Add(PlayerConditionModule.Get());
     SaveGame.m_Objects.Add(PlayerInjuryModule.Get());
     SaveGame.m_Objects.Add(PlayerDiseasesModule.Get());
     SaveGame.m_Objects.Add(StatsManager.Get());
     SaveGame.m_Objects.Add(HintsManager.Get());
     SaveGame.m_Objects.Add(MenuNotepad.Get());
     SaveGame.m_Objects.Add(MapTab.Get());
     SaveGame.m_Objects.Add(SleepController.Get());
     SaveGame.m_Objects.Add(DifficultySettings.Get());
     SaveGame.m_Objects.Add(InventoryBackpack.Get());
 }
예제 #21
0
    private void UpdateAlpha()
    {
        switch (this.m_State)
        {
        case HUDSleepingState.FadeIn:
            if (this.m_BG.color.a < 1f)
            {
                this.SetBGAlpha(this.m_BG.color.a + Time.deltaTime);
                return;
            }
            if (this.m_CanvasGroup.alpha < 1f)
            {
                this.m_CanvasGroup.alpha += Time.deltaTime;
                if (this.m_CanvasGroup.alpha >= 1f)
                {
                    this.m_State = HUDSleepingState.Progress;
                }
                this.m_CanvasGroup.alpha = Mathf.Clamp01(this.m_CanvasGroup.alpha);
                return;
            }
            break;

        case HUDSleepingState.Progress:
            if (!SleepController.Get().IsSleeping())
            {
                this.m_State = HUDSleepingState.FadeOut;
                return;
            }
            break;

        case HUDSleepingState.FadeOut:
            if (this.m_CanvasGroup.alpha > 0f)
            {
                this.m_CanvasGroup.alpha -= Time.deltaTime * 5f;
                this.m_CanvasGroup.alpha  = Mathf.Clamp01(this.m_CanvasGroup.alpha);
                return;
            }
            if (this.m_BG.color.a > 0f)
            {
                this.SetBGAlpha(this.m_BG.color.a - Time.deltaTime * 2f);
            }
            break;

        default:
            return;
        }
    }
예제 #22
0
    public static float GetSleepTimeFactor()
    {
        TOD_Sky  todsky  = MainLevel.Instance.m_TODSky;
        TOD_Time todtime = MainLevel.Instance.m_TODTime;
        bool     flag    = todsky.Cycle.Hour > 6f && todsky.Cycle.Hour <= 18f;
        float    num;

        if (flag)
        {
            num = todtime.m_DayLengthInMinutes / 12f * 60f;
        }
        else
        {
            num = todtime.m_NightLengthInMinutes / 12f * 60f;
        }
        return(num * SleepController.Get().m_HoursDelta);
    }
예제 #23
0
 protected override void OnHide()
 {
     base.OnHide();
     if (this.m_GoToSleep)
     {
         SleepController.Get().StartSleeping(this.m_RestingPlace, true);
         Player.Get().StartController(PlayerControllerType.Sleep);
         this.m_GoToSleep = false;
     }
     if (this.m_PlannerMode == PlannerMode.Summary)
     {
         for (int i = 0; i < Player.Get().GetComponent <PlayerPlannerModule>().m_PlannedTasks.Count; i++)
         {
             Player.Get().GetComponent <PlayerPlannerModule>().m_PlannedTasks[i].m_Fullfiled = false;
         }
         Player.Get().GetComponent <PlayerPlannerModule>().m_PlannedTasks.Clear();
     }
 }
예제 #24
0
    public void UpdateBuriningDuration()
    {
        if (!this.m_Burning)
        {
            return;
        }
        float num = MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;

        if (HUDSleeping.Get().GetState() == HUDSleepingState.Progress)
        {
            num = SleepController.Get().m_HoursDelta;
        }
        else if (ConsciousnessController.Get().IsUnconscious())
        {
            num = ConsciousnessController.Get().m_HoursDelta;
        }
        this.m_BurningDuration += num;
    }
예제 #25
0
    protected override void OnShow()
    {
        base.OnShow();
        this.m_CanvasGroup.alpha = 0f;
        int    num  = (int)MainLevel.Instance.m_TODSky.Cycle.Hour;
        int    num2 = (int)((MainLevel.Instance.m_TODSky.Cycle.Hour - (float)num) * 60f);
        string text = string.Format("{0}:{1:00}", num, num2);

        this.m_StartTime.text = text;
        num += SleepController.Get().m_SleepDuration;
        if (num >= 24)
        {
            num -= 24;
        }
        text = string.Format("{0}:{1:00}", num, num2);
        this.m_EndTime.text = text;
        this.SetBGAlpha(0f);
        CursorManager.Get().ShowCursor(true);
    }
예제 #26
0
 protected override void Update()
 {
     base.Update();
     this.UpdateParticle();
     this.UpdateState();
     this.UpdateSounds();
     if (!this.ReplIsOwner())
     {
         return;
     }
     if (base.IsInWater() && !base.m_InInventory)
     {
         WaterCollider waterCollider = this.m_CurrentWaters[this.m_CurrentWaters.Count - 1];
         this.m_LCInfo.m_LiquidType = (waterCollider.m_LiquidSource ? waterCollider.m_LiquidSource.m_LiquidType : LiquidType.UnsafeWater);
         this.m_LCInfo.m_Amount     = this.m_LCInfo.m_Capacity;
         return;
     }
     if (this.m_LCInfo.m_Amount < this.m_LCInfo.m_Capacity && !base.transform.parent && base.transform.up.y > 0.45f && RainManager.Get().IsRain() && !RainManager.Get().IsInRainCutter(base.transform.position))
     {
         bool flag = true;
         if (Inventory3DManager.Get().m_CarriedItem == this && RainManager.Get().IsInRainCutter(Player.Get().transform.position))
         {
             flag = false;
         }
         if (flag)
         {
             if (this.m_LCInfo.m_LiquidType != LiquidType.Water && this.m_LCInfo.m_Amount == 0f)
             {
                 this.m_LCInfo.m_LiquidType = LiquidType.Water;
             }
             if (this.m_LCInfo.m_LiquidType == LiquidType.Water)
             {
                 float num = Time.deltaTime;
                 if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
                 {
                     num = Player.GetSleepTimeFactor();
                 }
                 this.m_LCInfo.m_Amount += num * 0.2f;
                 this.m_LCInfo.m_Amount  = Mathf.Clamp(this.m_LCInfo.m_Amount, 0f, this.m_LCInfo.m_Capacity);
             }
         }
     }
 }
예제 #27
0
 public override void ConstantUpdate()
 {
     if (ItemsManager.Get().m_ItemsToSetupAfterLoad.Count > 0)
     {
         return;
     }
     base.ConstantUpdate();
     if (this.m_State == MudMixer.State.WaitingForWater && this.m_WaterAmount < this.m_RequiredWaterAmount && RainManager.Get().IsRain() && !RainManager.Get().IsInRainCutter(base.transform.position))
     {
         float num = Time.deltaTime;
         if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
         {
             num = Player.GetSleepTimeFactor();
         }
         this.m_WaterAmount += num * 8f;
         this.m_WaterAmount  = Mathf.Clamp(this.m_WaterAmount, 0f, this.m_RequiredWaterAmount);
         if (this.m_WaterAmount >= this.m_RequiredWaterAmount)
         {
             this.SetState(MudMixer.State.Full);
             return;
         }
     }
     else if (this.m_State == MudMixer.State.Ready)
     {
         int i = 0;
         while (i < this.m_ResultItems.Count)
         {
             if (this.m_ResultItems[i] == null || this.m_ResultItems[i].m_WasTriggered)
             {
                 this.m_ResultItems.RemoveAt(i);
             }
             else
             {
                 i++;
             }
         }
         if (this.m_ResultItems.Count == 0)
         {
             this.SetState(MudMixer.State.WaitingForClay0);
         }
     }
 }
예제 #28
0
    public override void Check()
    {
        float currentTimeMinutes = MainLevel.Instance.GetCurrentTimeMinutes();

        if (SleepController.Get().m_LastWakeUpTime <= 0f)
        {
            SleepController.Get().m_LastWakeUpTime = currentTimeMinutes;
        }
        if (SleepController.Get().m_LastWakeUpTimeLogical <= 0f)
        {
            SleepController.Get().m_LastWakeUpTimeLogical = currentTimeMinutes;
        }
        if (SleepController.Get().IsActive() && HUDSleeping.Get().GetState() == HUDSleepingState.Progress && this.m_InsomniaLevel == 0f)
        {
            SleepController.Get().m_LastWakeUpTimeLogical = MainLevel.Instance.GetCurrentTimeMinutes();
        }
        if (currentTimeMinutes > SleepController.Get().m_LastWakeUpTimeLogical + this.m_NoSleepTmeToActivate)
        {
            PlayerDiseasesModule.Get().RequestDisease(ConsumeEffect.Insomnia, 0f, 1);
        }
    }
예제 #29
0
    public override void ConstantUpdate()
    {
        base.ConstantUpdate();
        float num = Time.deltaTime;

        if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
        {
            num = Player.GetSleepTimeFactor();
        }
        this.UpdateWaterFromRain(num);
        if (!this.m_Active)
        {
            return;
        }
        this.m_Amount -= 10f * num;
        if (this.m_Amount <= 0f)
        {
            this.TurnOff();
        }
        Mathf.Clamp(this.m_Amount, 0f, this.m_Capacity);
    }
예제 #30
0
    public void UpdateSleeping()
    {
        float num  = 0f;
        float num2 = SleepController.Get().m_Progress *(float)SleepController.Get().m_SleepDuration;
        float num3 = SleepController.Get().m_LastProgress *(float)SleepController.Get().m_SleepDuration;

        if ((num2 >= 4f && num3 < 4f) || (num2 >= 8f && num3 < 8f))
        {
            num = 1f;
        }
        if (num <= 0f)
        {
            SleepController.Get().m_LastWakeUpTimeLogical += SleepController.Get().m_HoursDelta * 60f;
            return;
        }
        if (num >= this.m_InsomniaLevel)
        {
            SleepController.Get().m_LastWakeUpTimeLogical = MainLevel.Instance.GetCurrentTimeMinutes();
            return;
        }
        SleepController.Get().m_LastWakeUpTimeLogical += num * this.m_NoSleepTimeToIncreaseLevel;
    }