Example #1
0
 public static void SetupObjects()
 {
     SaveGame.m_Objects.Clear();
     SaveGame.m_Objects.Add(MainLevel.Instance);
     SaveGame.m_Objects.Add(Scenario.Get());
     SaveGame.m_Objects.Add(AIManager.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(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(BalanceSystem.Get());
 }
Example #2
0
    private float CalcChanceToGetWorm()
    {
        float num = this.m_WormChance;

        if (this.m_RestingPlace)
        {
            return(0f);
        }
        if (RainManager.Get().m_RainCone.activeSelf&& !this.m_Shelter)
        {
            num *= this.m_RainWormChanceFactor;
        }
        foreach (Firecamp firecamp in this.m_Firecamps)
        {
            if (firecamp.m_Burning)
            {
                float num2 = 1f;
                if (this.m_FireWormChanceFactor.TryGetValue((int)firecamp.m_Info.m_ID, out num2))
                {
                    num *= num2;
                }
            }
        }
        return(num);
    }
Example #3
0
    public void RefreshElements(Vector3 target, GameObject panorama, ERainType rain)
    {
        // Update panorama
        foreach (Transform child in layersContainer)
        {
            Destroy(child.gameObject);
        }

        GameObject layer = null;

        for (int i = 0; i < panorama.transform.childCount; i++)
        {
            layer     = Instantiate(panorama.transform.GetChild(i).gameObject, layersContainer);
            layers[i] = layer.GetComponent <TelescopeLayer>();
        }

        rainManager = layer.GetComponent <RainManager>();
        rainManager.UpdateRain(rain);

        ResetPosition();

        // Spwan map elements in sight
        foreach (MapElement element in boat.GetElementsInSight())
        {
            Island island = element.GetComponent <Island>();
            if (!island || island != boat.currentIsland)
            {
                AddElementToPanorama(element, target);
            }
        }

        RefreshElementsAngle();
    }
        protected override void Initialize()
        {
            // graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            // graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            // graphics.IsFullScreen = true;
            //if (!graphics.IsFullScreen)
            //    graphics.ToggleFullScreen();
            graphics.ApplyChanges();
            if (firsLoad)
            {
                mapManager.Initialize();
            }
            playerManager.Initialize();
            enemiesManager.Initialize();
            treasureManager = new TreasureManager(playerManager);
            rainManager     = new RainManager(playerManager.getPlayer(), enemiesManager);
            base.Initialize();

            CurrentGameState = GameState.MainMenu;
            if (firsLoad)
            {
                Task.Factory.StartNew(() =>
                {
                    var gl = new UpdateLoop(rainManager);
                    gl.Loop();
                });
            }

            spriteBatch = new SpriteBatch(GraphicsDevice);
        }
Example #5
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());
 }
Example #6
0
 private void Update()
 {
     if (this.m_RequestRegister && RainManager.Get())
     {
         RainManager.Get().RegisterRainCutter(this);
         this.m_RequestRegister = false;
     }
 }
Example #7
0
 public void Init(RainManager rainManager)
 {
     _secondsBetweenSpawns = rainManager.secondsBetweenSpawns;
     _maxXOffset           = rainManager.maxXOffset;
     transform.eulerAngles = new Vector3(0, 0, rainManager.rotation);
     _force = rainManager.force;
     StartCoroutine(SpawnRainDropCo());
 }
Example #8
0
 private void UpdateWaterFromRain(float delta_time)
 {
     if (this.m_Amount < this.m_Capacity && RainManager.Get().IsRain() && !RainManager.Get().IsInRainCutter(base.transform.position))
     {
         this.m_Amount += delta_time * 1.6f;
         this.m_Amount  = Mathf.Clamp(this.m_Amount, 0f, this.m_Capacity);
     }
 }
    private float CalcChanceToGetWorm()
    {
        float num = this.m_WormChance;

        if (RainManager.Get().m_RainCone.activeSelf)
        {
            num *= this.m_RainWormChanceFactor;
        }
        return(num);
    }
Example #10
0
 private void OnEnable()
 {
     if (RainManager.Get())
     {
         RainManager.Get().RegisterRainCutter(this);
     }
     else
     {
         this.m_RequestRegister = true;
     }
 }
Example #11
0
 private void CheckRain()
 {
     if (!this.m_Burning)
     {
         return;
     }
     if (RainManager.Get().IsRain() && Time.time - this.m_StartBurningTime > 1f && !RainManager.Get().IsInRainCutter(base.transform.position))
     {
         this.Extinguish();
     }
 }
Example #12
0
 private void UpdateParams()
 {
     for (int i = 0; i < this.m_Params.Count; i++)
     {
         int hash = this.m_Params[i].m_Hash;
         if (hash == MSMultiSample.s_DayTimeVolHash)
         {
             float value = MainLevel.Instance.m_TODSky.Cycle.Hour / 24f;
             this.m_ParamsMap[hash] = value;
         }
         else if (hash == MSMultiSample.s_WaterVolHash)
         {
             float value2 = Player.Get().IsCameraUnderwater() ? 1f : 0f;
             this.m_ParamsMap[hash] = value2;
         }
         else if (hash == MSMultiSample.s_RainVolHash)
         {
             float value3 = RainManager.Get().m_WeatherInterpolated *MainLevel.Instance.m_RainVolume;
             this.m_ParamsMap[hash] = value3;
         }
         else if (hash == MSMultiSample.s_RainTentVolHash)
         {
             float num  = (RainManager.Get().IsInRainCutterTent(Player.Get().GetLEyeTransform().position) && RainManager.Get().m_WeatherInterpolated > 0.9f) ? 1f : 0f;
             float num2 = 0f;
             if (!this.m_ParamsMap.TryGetValue(hash, out num2))
             {
                 this.m_ParamsMap[hash] = 0f;
             }
             else
             {
                 Dictionary <int, float> paramsMap = this.m_ParamsMap;
                 int key = hash;
                 paramsMap[key]        += (num - this.m_ParamsMap[hash]) * Time.deltaTime;
                 this.m_ParamsMap[hash] = Mathf.Clamp01(this.m_ParamsMap[hash]);
             }
         }
         else if (hash == MSMultiSample.s_WindVolHash)
         {
             float wind = RainManager.Get().m_Wind;
             this.m_ParamsMap[hash] = wind;
         }
         else if (hash == MSMultiSample.s_WindPitchHash)
         {
             float wind2 = RainManager.Get().m_Wind;
             this.m_ParamsMap[hash] = wind2;
         }
         else if (hash == MSMultiSample.s_AreaDensityVolHash)
         {
             float areaDensity = RainManager.Get().m_AreaDensity;
             this.m_ParamsMap[hash] = areaDensity;
         }
     }
 }
 private void UpdateWaterFromRain(float delta_time)
 {
     if (this.m_CollectorData.m_Amount < this.m_CollectorData.m_Capacity && RainManager.Get().IsRain() && !RainManager.Get().IsInRainCutter(this.m_CollectorWaterVis.transform.position))
     {
         if (this.m_CollectorData.m_Amount < 1f)
         {
             this.m_CollectorLiquidType = LiquidType.Water;
         }
         this.m_CollectorData.m_Amount += delta_time;
         this.m_CollectorData.m_Amount  = Mathf.Clamp(this.m_CollectorData.m_Amount, 0f, this.m_CollectorData.m_Capacity);
     }
 }
Example #14
0
    void Start()
    {
        manager = transform.parent.GetComponent <RainManager> ();

        bounds = new Bounds(new Vector3(transform.position.x, manager.minYPosition, transform.position.z),
                            new Vector3(manager.areaSize * 1.35f, Mathf.Max(manager.areaSize, manager.areaHeight) * 1.35f, manager.areaSize * 1.35f));

        mf            = GetComponent <MeshFilter> ();
        mf.sharedMesh = manager.GetPreGennedMesh();

        cachedTransform    = transform;
        cam                = transform.parent.transform;
        cachedMinY         = manager.minYPosition;
        cachedAreaHeight   = manager.areaHeight;
        cachedFallingSpeed = manager.fallingSpeed;
    }
Example #15
0
    void Start()
    {
        manager = transform.parent.GetComponent<RainManager>();

        bounds = new Bounds(new Vector3(transform.position.x, manager.minYPosition, transform.position.z),
                             new Vector3(manager.areaSize * 1.35f, Mathf.Max(manager.areaSize, manager.areaHeight) * 1.35f, manager.areaSize * 1.35f));

        mf = GetComponent<MeshFilter>();
        mf.sharedMesh = manager.GetPreGennedMesh();

        cachedTransform = transform;
        cachedMinY = manager.minYPosition;
        cachedAreaHeight = manager.areaHeight;
        cachedFallingSpeed = manager.fallingSpeed;

        enabled = false;
    }
Example #16
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);
             }
         }
     }
 }
Example #17
0
 protected override void Update()
 {
     base.Update();
     if (RainManager.Get().IsRain())
     {
         base.transform.position = base.transform.position + Vector3.up * this.m_Speed * Time.deltaTime;
         if (base.transform.position.y > this.m_RainPos.y)
         {
             base.transform.position = this.m_RainPos;
         }
     }
     else
     {
         base.transform.position = base.transform.position - Vector3.up * this.m_Speed * Time.deltaTime;
         if (base.transform.position.y < this.m_OrigPos.y)
         {
             base.transform.position = this.m_OrigPos;
         }
     }
 }
Example #18
0
 public void CheckRain()
 {
     if (!this.m_Burning)
     {
         this.m_RainDuration = 0f;
         return;
     }
     if (RainManager.Get().IsRain() && !RainManager.Get().IsInRainCutter(base.transform.position))
     {
         this.m_RainDuration += Time.deltaTime;
         if (this.m_RainDuration >= this.m_MinRainDurationToExtinguish)
         {
             this.Extinguish();
         }
     }
     else
     {
         this.m_RainDuration = 0f;
     }
 }
Example #19
0
 private void Start()
 {
     this.cachedTransform = base.get_transform();
     this.manager         = this.cachedTransform.GetComponentInParent <RainManager>();
     if (this.manager == null)
     {
         Debug.LogError("RainManager is null");
     }
     this.SetBounds();
     this.mf = base.GetComponent <MeshFilter>();
     this.mf.set_sharedMesh(this.manager.GetPreGennedMesh());
     this.cachedMinY       = this.manager.minYPosition;
     this.cachedAreaHeight = this.manager.areaHeight;
     this.SetFallingSpeed();
     this.SetDirection(this.manager.fallingDirection);
     if (RainEffectManager.Instance != null)
     {
         RainEffectManager.Instance.AddRainTimer(this);
     }
     base.set_enabled(false);
 }
Example #20
0
    void OnDrawGizmos()
    {
    #if UNITY_EDITOR
        // do not display a weird mesh in edit mode
        if (!Application.isPlaying)
        {
            mf            = GetComponent <MeshFilter> ();
            mf.sharedMesh = null;
        }
    #endif

        if (transform.parent)
        {
            Gizmos.color = new Color(0.2f, 0.3f, 3.0f, 0.35f);
            RainManager manager = transform.parent.GetComponent <RainManager>();
            if (manager)
            {
                Gizmos.DrawWireCube(transform.position + transform.up * manager.areaHeight * 0.5f,
                                    new Vector3(manager.areaSize, manager.areaHeight, manager.areaSize));
            }
        }
    }
Example #21
0
 private void UpdateParams()
 {
     for (int i = 0; i < this.m_Params.Count; i++)
     {
         int hash = this.m_Params[i].m_Hash;
         if (hash == MSMultiSample.s_DayTimeVolHash)
         {
             float value = MainLevel.Instance.m_TODSky.Cycle.Hour / 24f;
             this.m_ParamsMap[hash] = value;
         }
         else if (hash == MSMultiSample.s_WaterVolHash)
         {
             float value2 = (!SwimController.Get().IsActive() || SwimController.Get().m_State != SwimState.Dive) ? 0f : 1f;
             this.m_ParamsMap[hash] = value2;
         }
         else if (hash == MSMultiSample.s_RainVolHash)
         {
             float weatherInterpolated = RainManager.Get().m_WeatherInterpolated;
             this.m_ParamsMap[hash] = weatherInterpolated;
         }
         else if (hash == MSMultiSample.s_WindVolHash)
         {
             float wind = RainManager.Get().m_Wind;
             this.m_ParamsMap[hash] = wind;
         }
         else if (hash == MSMultiSample.s_WindPitchHash)
         {
             float wind2 = RainManager.Get().m_Wind;
             this.m_ParamsMap[hash] = wind2;
         }
         else if (hash == MSMultiSample.s_AreaDensityVolHash)
         {
             float areaDensity = RainManager.Get().m_AreaDensity;
             this.m_ParamsMap[hash] = areaDensity;
         }
     }
 }
Example #22
0
 private void UpdateInputsDebug()
 {
     if (!GreenHellGame.DEBUG || MenuInGameManager.Get().IsAnyScreenVisible())
     {
         return;
     }
     if (Input.GetKeyDown(KeyCode.Numlock))
     {
         this.CycleTimeScaleSlowdown();
     }
     else if (Input.GetKeyDown(KeyCode.KeypadDivide))
     {
         this.CycleTimeScaleSpeedup();
     }
     else if (Input.GetKeyDown(KeyCode.KeypadPlus))
     {
         this.m_TODTime.AddHours(1f, true);
         ReflectionProbeUpdater[] array = UnityEngine.Object.FindObjectsOfType <ReflectionProbeUpdater>();
         for (int i = 0; i < array.Length; i++)
         {
             array[i].RenderProbe();
         }
     }
     else if (Input.GetKeyDown(KeyCode.KeypadMinus))
     {
         this.m_TODTime.AddHours(-1f, true);
         ReflectionProbeUpdater[] array2 = UnityEngine.Object.FindObjectsOfType <ReflectionProbeUpdater>();
         for (int j = 0; j < array2.Length; j++)
         {
             array2[j].RenderProbe();
         }
     }
     else if (Input.GetKeyDown(KeyCode.KeypadEnter))
     {
         this.m_TODTime.AddHours(10f, true);
         ReflectionProbeUpdater[] array3 = UnityEngine.Object.FindObjectsOfType <ReflectionProbeUpdater>();
         for (int k = 0; k < array3.Length; k++)
         {
             array3[k].RenderProbe();
         }
     }
     else if (Input.GetKeyDown(KeyCode.Pause))
     {
         this.m_DebugPause = !this.m_DebugPause;
         CursorManager.Get().ShowCursor(this.m_DebugPause);
         this.Pause(this.m_DebugPause);
         if (this.m_DebugPause)
         {
             Player.Get().BlockMoves();
             Player.Get().BlockRotation();
         }
         else
         {
             Player.Get().UnblockMoves();
             Player.Get().UnblockRotation();
         }
     }
     else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.M))
     {
         Cheats.m_GodMode = !Cheats.m_GodMode;
     }
     else if (Input.GetKeyDown(KeyCode.KeypadPeriod))
     {
         this.m_TODTime.ProgressTime = !this.m_TODTime.ProgressTime;
     }
     else if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.BackQuote))
     {
         if (Input.GetKey(KeyCode.LeftShift))
         {
             Player.Get().TwentyFivePointsOfDamage();
         }
         else
         {
             Player.Get().Kill();
             Player.Get().UpdateDeath();
         }
     }
     else if (Input.GetKeyDown(KeyCode.Equals))
     {
         if (Input.GetKey(KeyCode.LeftShift))
         {
             RainManager.Get().ToggleDebug();
         }
         else
         {
             RainManager.Get().ToggleRain();
         }
     }
     else if (Input.GetKeyDown(KeyCode.Semicolon))
     {
         this.PlayMovieWithFade("Tutorial_End");
     }
     else if (Input.GetKeyDown(KeyCode.Minus))
     {
         this.m_DebugShowCursor = !this.m_DebugShowCursor;
         CursorManager.Get().ShowCursor(this.m_DebugShowCursor);
         if (this.m_DebugShowCursor)
         {
             Vector2 zero = Vector2.zero;
             zero.Set((float)(Screen.width / 2), (float)(Screen.height / 2));
             CursorManager.Get().SetCursorPos(zero);
         }
     }
     else if (Input.GetKeyDown(KeyCode.U) && !Input.GetKey(KeyCode.LeftControl))
     {
         ParticleSystem[] array4 = Resources.FindObjectsOfTypeAll <ParticleSystem>();
         int num  = 0;
         int num2 = 0;
         for (int l = 0; l < array4.Length; l++)
         {
             bool activeInHierarchy = array4[l].gameObject.activeInHierarchy;
             Debug.Log("ParticleSystem " + array4[l].gameObject.name + ((!activeInHierarchy) ? " 0" : " 1"));
             if (activeInHierarchy)
             {
                 num++;
             }
             else
             {
                 num2++;
             }
         }
         Debug.Log("ParticleSystem num active " + num.ToString());
         Debug.Log("ParticleSystem num inactive " + num2.ToString());
     }
     else if (Input.GetKeyDown(KeyCode.LeftBracket) || Input.GetKeyDown(KeyCode.RightBracket))
     {
         if (this.m_CutscenePlayer == null)
         {
             GameObject original;
             if (Input.GetKeyDown(KeyCode.LeftBracket))
             {
                 original = (Resources.Load("Prefabs/TempPrefabs/CutscenePlayer/CutscenePlayer") as GameObject);
             }
             else
             {
                 original = (Resources.Load("Prefabs/TempPrefabs/CutscenePlayer/CutscenePlayer2") as GameObject);
             }
             this.m_CutscenePlayer = UnityEngine.Object.Instantiate <GameObject>(original);
             this.m_CutscenePlayer.transform.rotation = Player.Get().transform.rotation;
             this.m_CutscenePlayer.transform.position = Player.Get().transform.position;
             CameraManager.Get().SetTarget(this.m_CutscenePlayer.GetComponent <Being>());
             CameraManager.Get().SetMode(CameraManager.Mode.CutscenePlayer);
         }
         else
         {
             UnityEngine.Object.Destroy(this.m_CutscenePlayer);
             this.m_CutscenePlayer = null;
             CameraManager.Get().SetTarget(Player.Get());
             CameraManager.Get().SetMode(CameraManager.Mode.Normal);
         }
     }
     else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F6))
     {
         Player.Get().StartController(PlayerControllerType.BodyInspectionMiniGame);
     }
     else if (Input.GetKeyDown(KeyCode.Keypad9))
     {
         SaveGame.Save();
     }
     if (Input.GetKey(KeyCode.LeftControl))
     {
         HUDCameraPosition.Get().m_Active = true;
     }
     else
     {
         HUDCameraPosition.Get().m_Active = false;
     }
 }
Example #23
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);
         }
     }
 }
Example #24
0
    public void CheckLeeches()
    {
        if (GreenHellGame.ROADSHOW_DEMO)
        {
            return;
        }
        if (PlayerConditionModule.Get().GetParameterLossBlocked() || Time.time - MainLevel.Instance.m_LevelStartTime < 20f)
        {
            return;
        }
        if (!DifficultySettings.ActivePreset.m_Leeches)
        {
            return;
        }
        if (!this.m_LeechNextTimeInitialized)
        {
            this.m_LeechNextTime2           = Injury.s_LeechCooldownInMinutes + MainLevel.Instance.GetCurrentTimeMinutes();
            this.m_LeechNextTimeInitialized = true;
        }
        if (MainLevel.Instance.GetCurrentTimeMinutes() < this.m_LeechNextTime2)
        {
            return;
        }
        InjuryType injuryType;

        if (this.m_Player.IsInWater())
        {
            if (this.m_LeechChanceInsideWater < UnityEngine.Random.Range(0f, 1f))
            {
                return;
            }
            injuryType = InjuryType.Leech;
        }
        else
        {
            if (this.m_LeechChanceOutsideOfWater < UnityEngine.Random.Range(0f, 1f))
            {
                return;
            }
            injuryType = InjuryType.Leech;
        }
        InjuryPlace place;

        if (this.m_Player.IsInWater() && !SwimController.Get().IsActive())
        {
            place = (InjuryPlace)UnityEngine.Random.Range(2, 4);
        }
        else
        {
            place = (InjuryPlace)UnityEngine.Random.Range(0, 4);
        }
        int num = UnityEngine.Random.Range(1, 4);

        if (RainManager.Get().m_WeatherInterpolated >= 1f)
        {
            num = UnityEngine.Random.Range(3, 6);
        }
        for (int i = 0; i < num; i++)
        {
            BIWoundSlot freeWoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(place, injuryType, true);
            if (freeWoundSlot == null)
            {
                return;
            }
            this.AddInjury(injuryType, place, freeWoundSlot, InjuryState.Open, 0, null, null);
            this.m_LeechNextTime2 = Injury.s_LeechCooldownInMinutes + MainLevel.Instance.GetCurrentTimeMinutes();
        }
    }
Example #25
0
 public void UpdateProcessing()
 {
     foreach (ItemSlot itemSlot in this.m_ActiveSlots)
     {
         Food food = (Food)itemSlot.m_Item;
         if (this.m_Firecamp)
         {
             if (!this.m_Firecamp.m_Burning)
             {
                 if (food.m_ProcessDuration > 0f)
                 {
                     food.m_ProcessDuration -= MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
                 }
                 else
                 {
                     food.m_ProcessDuration = 0f;
                 }
                 if (!itemSlot.gameObject.activeSelf)
                 {
                     itemSlot.gameObject.SetActive(true);
                 }
                 if (!itemSlot.m_Item.enabled)
                 {
                     itemSlot.m_Item.enabled = true;
                 }
                 continue;
             }
         }
         else if (this.m_Type != FoodProcessor.Type.Dryer && (!this.m_ConnectedFirecamp || !this.m_ConnectedFirecamp.m_Burning))
         {
             if (food.m_ProcessDuration > 0f)
             {
                 food.m_ProcessDuration -= MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
             }
             else
             {
                 food.m_ProcessDuration = 0f;
             }
             if (!itemSlot.gameObject.activeSelf)
             {
                 itemSlot.gameObject.SetActive(true);
             }
             if (!itemSlot.m_Item.enabled)
             {
                 itemSlot.m_Item.enabled = true;
             }
             continue;
         }
         if (this.m_Type == FoodProcessor.Type.Dryer)
         {
             if (!RainManager.Get().IsRain())
             {
                 food.m_ProcessDuration += MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
             }
             else if (food.m_ProcessDuration > 0f)
             {
                 food.m_ProcessDuration -= MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
             }
             else
             {
                 food.m_ProcessDuration = 0f;
             }
         }
         else
         {
             food.m_ProcessDuration += MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
         }
         FoodInfo foodInfo = (FoodInfo)itemSlot.m_Item.m_Info;
         if (itemSlot.m_Item.enabled)
         {
             if (this.m_Type != FoodProcessor.Type.Dryer)
             {
                 itemSlot.m_Item.enabled = !foodInfo.m_CanCook;
             }
             else
             {
                 itemSlot.m_Item.enabled = !foodInfo.m_CanDry;
             }
         }
         if (food.m_ProcessDuration >= this.GetProcessingTime(foodInfo) || this.m_DebugImmediate)
         {
             HUDProcess.Get().UnregisterProcess(itemSlot.m_Item);
             Item item = this.m_ItemsManager.CreateItem(this.GetResultItemID(foodInfo), true, itemSlot.m_Item.transform.position, itemSlot.m_Item.transform.rotation);
             itemSlot.ReplaceItem(item);
             if (!this.m_ProcessedSlots.Contains(itemSlot))
             {
                 this.m_ProcessedSlots.Add(itemSlot);
             }
             this.m_DebugImmediate = false;
             if (this.m_Type == FoodProcessor.Type.Fire && !foodInfo.m_CanCook)
             {
                 food.m_Burned = true;
             }
             break;
         }
     }
 }
Example #26
0
    private void UpdateCelestials()
    {
        float f         = 0.0174532924f * this.World.Latitude;
        float num       = Mathf.Sin(f);
        float num2      = Mathf.Cos(f);
        float longitude = this.World.Longitude;
        float num3      = 1.57079637f;
        int   year      = this.Cycle.Year;
        int   month     = this.Cycle.Month;
        int   day       = this.Cycle.Day;
        float num4      = this.Cycle.Hour - this.World.UTC;
        float num5      = (float)(367 * year - 7 * (year + (month + 9) / 12) / 4 + 275 * month / 9 + day - 730530) + num4 / 24f;
        float num6      = (float)(367 * year - 7 * (year + (month + 9) / 12) / 4 + 275 * month / 9 + day - 730530) + 0.5f;
        float num7      = 23.4393f - 3.563E-07f * num5;
        float f2        = 0.0174532924f * num7;
        float num8      = Mathf.Sin(f2);
        float num9      = Mathf.Cos(f2);
        float num10     = 282.9404f + 4.70935E-05f * num6;
        float num11     = 0.016709f - 1.151E-09f * num6;
        float num12     = 356.047f + 0.985600233f * num6;
        float num13     = 0.0174532924f * num12;
        float num14     = Mathf.Sin(num13);
        float num15     = Mathf.Cos(num13);
        float f3        = num13 + num11 * num14 * (1f + num11 * num15);
        float num16     = Mathf.Sin(f3);
        float num17     = Mathf.Cos(f3) - num11;
        float num18     = Mathf.Sqrt(1f - num11 * num11) * num16;
        float num19     = 57.29578f * Mathf.Atan2(num18, num17);
        float num20     = Mathf.Sqrt(num17 * num17 + num18 * num18);
        float num21     = num19 + num10;
        float f4        = 0.0174532924f * num21;
        float num22     = Mathf.Sin(f4);
        float num23     = Mathf.Cos(f4);
        float num24     = num20 * num23;
        float num25     = num20 * num22;
        float num26     = num24;
        float num27     = num25 * num9;
        float y         = num25 * num8;
        float num28     = Mathf.Atan2(num27, num26);
        float num29     = 57.29578f * num28;
        float f5        = Mathf.Atan2(y, Mathf.Sqrt(num26 * num26 + num27 * num27));
        float num30     = Mathf.Sin(f5);
        float num31     = Mathf.Cos(f5);
        float num32     = num19 + num10 + 180f;
        float num33     = num29 - num32 - longitude;
        float num34     = -6f;
        float num35     = Mathf.Acos((Mathf.Sin(0.0174532924f * num34) - num * num30) / (num2 * num31));
        float num36     = 57.29578f * num35;

        this.SunsetTime  = (24f + (num33 + num36) / 15f % 24f) % 24f;
        this.SunriseTime = (24f + (num33 - num36) / 15f % 24f) % 24f;
        float num37 = 282.9404f + 4.70935E-05f * num5;
        float num38 = 0.016709f - 1.151E-09f * num5;
        float num39 = 356.047f + 0.985600233f * num5;
        float num40 = 0.0174532924f * num39;
        float num41 = Mathf.Sin(num40);
        float num42 = Mathf.Cos(num40);
        float f6    = num40 + num38 * num41 * (1f + num38 * num42);
        float num43 = Mathf.Sin(f6);
        float num44 = Mathf.Cos(f6) - num38;
        float num45 = Mathf.Sqrt(1f - num38 * num38) * num43;
        float num46 = 57.29578f * Mathf.Atan2(num45, num44);
        float num47 = Mathf.Sqrt(num44 * num44 + num45 * num45);
        float num48 = num46 + num37;
        float f7    = 0.0174532924f * num48;
        float num49 = Mathf.Sin(f7);
        float num50 = Mathf.Cos(f7);
        float num51 = num47 * num50;
        float num52 = num47 * num49;
        float num53 = num51;
        float num54 = num52 * num9;
        float y2    = num52 * num8;
        float num55 = Mathf.Atan2(num54, num53);
        float f8    = Mathf.Atan2(y2, Mathf.Sqrt(num53 * num53 + num54 * num54));
        float num56 = Mathf.Sin(f8);
        float num57 = Mathf.Cos(f8);
        float num58 = num46 + num37 + 180f + 15f * num4;
        float num59 = 0.0174532924f * (num58 + longitude);

        this.LocalSiderealTime = (num58 + longitude) / 15f;
        float f9    = num59 - num55;
        float num60 = Mathf.Sin(f9);
        float num61 = Mathf.Cos(f9) * num57;
        float num62 = num60 * num57;
        float num63 = num56;
        float num64 = num61 * num - num63 * num2;
        float num65 = num62;
        float y3    = num61 * num2 + num63 * num;
        float num66 = Mathf.Atan2(num65, num64) + 3.14159274f;
        float num67 = Mathf.Atan2(y3, Mathf.Sqrt(num64 * num64 + num65 * num65));
        float num68 = num3 - num67;
        float num69 = num67;
        float num70 = num66;

        this.SunZenith   = 57.29578f * num68;
        this.SunAltitude = 57.29578f * num69;
        this.SunAzimuth  = 57.29578f * num70;
        float num112;
        float num113;
        float num114;

        if (this.Moon.Position == TOD_MoonPositionType.Realistic)
        {
            float num71  = 125.1228f - 0.05295381f * num5;
            float num72  = 5.1454f;
            float num73  = 318.0634f + 0.164357319f * num5;
            float num74  = 60.2666f;
            float num75  = 0.0549f;
            float num76  = 115.3654f + 13.0649929f * num5;
            float f10    = 0.0174532924f * num71;
            float num77  = Mathf.Sin(f10);
            float num78  = Mathf.Cos(f10);
            float f11    = 0.0174532924f * num72;
            float num79  = Mathf.Sin(f11);
            float num80  = Mathf.Cos(f11);
            float num81  = 0.0174532924f * num76;
            float num82  = Mathf.Sin(num81);
            float num83  = Mathf.Cos(num81);
            float f12    = num81 + num75 * num82 * (1f + num75 * num83);
            float num84  = Mathf.Sin(f12);
            float num85  = Mathf.Cos(f12);
            float num86  = num74 * (num85 - num75);
            float num87  = num74 * (Mathf.Sqrt(1f - num75 * num75) * num84);
            float num88  = 57.29578f * Mathf.Atan2(num87, num86);
            float num89  = Mathf.Sqrt(num86 * num86 + num87 * num87);
            float num90  = num88 + num73;
            float f13    = 0.0174532924f * num90;
            float num91  = Mathf.Sin(f13);
            float num92  = Mathf.Cos(f13);
            float num93  = num89 * (num78 * num92 - num77 * num91 * num80);
            float num94  = num89 * (num77 * num92 + num78 * num91 * num80);
            float num95  = num89 * (num91 * num79);
            float num96  = num93;
            float num97  = num94;
            float num98  = num95;
            float num99  = num96;
            float num100 = num97 * num9 - num98 * num8;
            float y4     = num97 * num8 + num98 * num9;
            float num101 = Mathf.Atan2(num100, num99);
            float f14    = Mathf.Atan2(y4, Mathf.Sqrt(num99 * num99 + num100 * num100));
            float num102 = Mathf.Sin(f14);
            float num103 = Mathf.Cos(f14);
            float f15    = num59 - num101;
            float num104 = Mathf.Sin(f15);
            float num105 = Mathf.Cos(f15) * num103;
            float num106 = num104 * num103;
            float num107 = num102;
            float num108 = num105 * num - num107 * num2;
            float num109 = num106;
            float y5     = num105 * num2 + num107 * num;
            float num110 = Mathf.Atan2(num109, num108) + 3.14159274f;
            float num111 = Mathf.Atan2(y5, Mathf.Sqrt(num108 * num108 + num109 * num109));
            num112 = num3 - num111;
            num113 = num111;
            num114 = num110;
        }
        else
        {
            num112 = num68 - 3.14159274f;
            num113 = num69 - 3.14159274f;
            num114 = num70;
        }
        this.MoonZenith   = 57.29578f * num112;
        this.MoonAltitude = 57.29578f * num113;
        this.MoonAzimuth  = 57.29578f * num114;
        Quaternion quaternion = Quaternion.Euler(90f - this.World.Latitude, 0f, 0f) * Quaternion.Euler(0f, this.World.Longitude, 0f) * Quaternion.Euler(0f, num59 * 57.29578f, 0f);

        if (this.Stars.Position == TOD_StarsPositionType.Rotating)
        {
            this.Components.SpaceTransform.localRotation = quaternion;
            this.Components.StarTransform.localRotation  = quaternion;
        }
        else
        {
            this.Components.SpaceTransform.localRotation = Quaternion.identity;
            this.Components.StarTransform.localRotation  = Quaternion.identity;
        }
        Vector3 localPosition = this.OrbitalToLocal(num68, num70);

        this.Components.SunTransform.localPosition = localPosition;
        this.Components.SunTransform.LookAt(this.Components.DomeTransform.position, this.Components.SunTransform.up);
        Vector3 localPosition2 = this.OrbitalToLocal(num112, num114);
        Vector3 worldUp        = quaternion * -Vector3.right;

        this.Components.MoonTransform.localPosition = localPosition2;
        this.Components.MoonTransform.LookAt(this.Components.DomeTransform.position, worldUp);
        float   num115     = 8f * Mathf.Tan(0.008726646f * this.Sun.MeshSize);
        Vector3 localScale = new Vector3(num115, num115, num115);

        this.Components.SunTransform.localScale = localScale;
        float   num116      = 4f * Mathf.Tan(0.008726646f * this.Moon.MeshSize);
        Vector3 localScale2 = new Vector3(num116, num116, num116);

        this.Components.MoonTransform.localScale = localScale2;
        if (RainManager.Get() != null && MainLevel.Instance.m_TODAtmosphereAndCloudsUpdateEnabled)
        {
            float a = (this.Cycle.Hour > 19f || this.Cycle.Hour < 7f) ? 0f : 0.5f;
            this.Atmosphere.Fogginess = CJTools.Math.GetProportionalClamp(0f, a, RainManager.Get().m_WeatherInterpolated, 0f, 1f);
            this.Clouds.Coverage      = CJTools.Math.GetProportionalClamp(this.m_DefaultCloudsCoverage, 0.8f, RainManager.Get().m_WeatherInterpolated, 0f, 1f);
            this.Clouds.Opacity       = CJTools.Math.GetProportionalClamp(this.m_DefaultCloudsOpacity, 0.8f, RainManager.Get().m_WeatherInterpolated, 0f, 1f);
        }
        bool enabled = (1f - this.Atmosphere.Fogginess) * (1f - this.LerpValue) > 0f;

        this.Components.SpaceRenderer.enabled = enabled;
        this.Components.StarRenderer.enabled  = enabled;
        bool enabled2 = this.Components.SunTransform.localPosition.y > -num115;

        this.Components.SunRenderer.enabled = enabled2;
        bool enabled3 = this.Components.MoonTransform.localPosition.y > -num116;

        this.Components.MoonRenderer.enabled = enabled3;
        bool enabled4 = true;

        this.Components.AtmosphereRenderer.enabled = enabled4;
        bool enabled5 = this.Components.Rays != null;

        this.Components.ClearRenderer.enabled = enabled5;
        bool enabled6 = this.Clouds.Coverage > 0f && this.Clouds.Opacity > 0f;

        this.Components.CloudRenderer.enabled = enabled6;
        this.LerpValue = Mathf.InverseLerp(105f, 90f, this.SunZenith);
        float time   = Mathf.Clamp01(this.SunZenith / 90f);
        float time2  = Mathf.Clamp01((this.SunZenith - 90f) / 90f);
        float num117 = Mathf.Clamp01((this.LerpValue - 0.1f) / 0.9f);
        float num118 = Mathf.Clamp01((0.1f - this.LerpValue) / 0.1f);
        float num119 = Mathf.Clamp01((90f - num112 * 57.29578f) / 5f);

        this.SunVisibility  = (1f - this.Atmosphere.Fogginess) * num117;
        this.MoonVisibility = (1f - this.Atmosphere.Fogginess) * num118 * num119;
        this.SunLightColor  = TOD_Util.ApplyAlpha(this.Day.LightColor.Evaluate(time));
        this.MoonLightColor = TOD_Util.ApplyAlpha(this.Night.LightColor.Evaluate(time2));
        this.SunRayColor    = TOD_Util.ApplyAlpha(this.Day.RayColor.Evaluate(time));
        this.MoonRayColor   = TOD_Util.ApplyAlpha(this.Night.RayColor.Evaluate(time2));
        this.SunSkyColor    = TOD_Util.ApplyAlpha(this.Day.SkyColor.Evaluate(time));
        this.MoonSkyColor   = TOD_Util.ApplyAlpha(this.Night.SkyColor.Evaluate(time2));
        this.SunMeshColor   = TOD_Util.ApplyAlpha(this.Day.SunColor.Evaluate(time));
        this.MoonMeshColor  = TOD_Util.ApplyAlpha(this.Night.MoonColor.Evaluate(time2));
        this.SunCloudColor  = TOD_Util.ApplyAlpha(this.Day.CloudColor.Evaluate(time));
        this.MoonCloudColor = TOD_Util.ApplyAlpha(this.Night.CloudColor.Evaluate(time2));
        Color b  = TOD_Util.ApplyAlpha(this.Day.FogColor.Evaluate(time));
        Color a2 = TOD_Util.ApplyAlpha(this.Night.FogColor.Evaluate(time2));

        this.FogColor = Color.Lerp(a2, b, this.LerpValue);
        Color color  = TOD_Util.ApplyAlpha(this.Day.AmbientColor.Evaluate(time));
        Color color2 = TOD_Util.ApplyAlpha(this.Night.AmbientColor.Evaluate(time2));

        if (CaveSensor.s_NumSensorsInside != 0)
        {
            this.AmbientColor += (Color.black - this.AmbientColor) * Time.deltaTime;
            if (this.AmbientColor != Color.black)
            {
                this.Ambient.UpdateInterval = 0f;
            }
            else
            {
                this.Ambient.UpdateInterval = 1f;
            }
        }
        else
        {
            Color color3 = Color.Lerp(color2, color, this.LerpValue);
            this.AmbientColor += (color3 - this.AmbientColor) * Time.deltaTime;
            if (this.AmbientColor != color3)
            {
                this.Ambient.UpdateInterval = 0f;
            }
            else
            {
                this.Ambient.UpdateInterval = 1f;
            }
        }
        Color b2 = color;
        Color a3 = color2;

        this.GroundColor   = Color.Lerp(a3, b2, this.LerpValue);
        this.MoonHaloColor = TOD_Util.MulRGB(this.MoonSkyColor, this.Moon.HaloBrightness * num119);
        float shadowStrength;
        float intensity;
        Color color4;

        if (this.LerpValue > 0.1f)
        {
            this.IsDay     = true;
            this.IsNight   = false;
            shadowStrength = this.Day.ShadowStrength;
            intensity      = Mathf.Lerp(0f, this.Day.LightIntensity * this.Day.m_SanityLightIntensityMul, this.SunVisibility);
            color4         = this.SunLightColor;
        }
        else
        {
            this.IsDay     = false;
            this.IsNight   = true;
            shadowStrength = this.Night.ShadowStrength;
            intensity      = Mathf.Lerp(0f, this.Night.LightIntensity * this.Night.m_SanityLightIntensityMul, this.MoonVisibility);
            color4         = this.MoonLightColor;
        }
        this.Components.LightSource.color          = color4;
        this.Components.LightSource.intensity      = intensity;
        this.Components.LightSource.shadowStrength = shadowStrength;
        if (!Application.isPlaying || this.timeSinceLightUpdate >= this.Light.UpdateInterval)
        {
            this.timeSinceLightUpdate = 0f;
            Vector3 localPosition3 = this.IsNight ? this.OrbitalToLocal(Mathf.Min(num112, (1f - this.Light.MinimumHeight) * 3.14159274f / 2f), num114) : this.OrbitalToLocal(Mathf.Min(num68, (1f - this.Light.MinimumHeight) * 3.14159274f / 2f), num70);
            this.Components.LightTransform.localPosition = localPosition3;
            this.Components.LightTransform.LookAt(this.Components.DomeTransform.position);
        }
        else
        {
            this.timeSinceLightUpdate += Time.deltaTime;
        }
        this.SunDirection        = -this.Components.SunTransform.forward;
        this.LocalSunDirection   = this.Components.DomeTransform.InverseTransformDirection(this.SunDirection);
        this.MoonDirection       = -this.Components.MoonTransform.forward;
        this.LocalMoonDirection  = this.Components.DomeTransform.InverseTransformDirection(this.MoonDirection);
        this.LightDirection      = -this.Components.LightTransform.forward;
        this.LocalLightDirection = this.Components.DomeTransform.InverseTransformDirection(this.LightDirection);
    }
Example #27
0
    void Awake()
    {
        if (alPrScr == null)
        {
            alPrScr = FindObjectOfType <AllPrefsScript>();
        }
        if (univFunc == null)
        {
            univFunc = FindObjectOfType <UniversalFunctions>();
        }
        if (gM == null)
        {
            gM = FindObjectOfType <GameManager> ();
        }
        if (adMob == null)
        {
            adMob = FindObjectOfType <AndroidAdMob_0>();
        }
        if (buf == null)
        {
            buf = FindObjectOfType <Buffer>();
        }

        if (cntrL == null)
        {
            cntrL = FindObjectOfType <CountriesList>();
        }
        if (plL == null)
        {
            plL = FindObjectOfType <PlayersList>();
        }
        if (prMng == null)
        {
            prMng = FindObjectOfType <ProfileManager>();
        }

        switch (SceneManager.GetActiveScene().buildIndex)
        {
        case 1:
            if (upgr == null)
            {
                upgr = FindObjectOfType <Upgrades>();
            }
            if (allAw == null)
            {
                allAw = FindObjectOfType <AllAwardsScript>();
            }
            if (topPanMng == null)
            {
                topPanMng = FindObjectOfType <TopPanelManager>();
            }
            if (objM == null)
            {
                objM = FindObjectOfType <Objects_Menu>();
            }
            if (currPrPan == null)
            {
                currPrPan = FindObjectOfType <CurrentProfilePanel>();
            }
            if (everyDayReward == null)
            {
                everyDayReward = FindObjectOfType <EverydayReward>();
            }
            if (carMng == null)
            {
                carMng = FindObjectOfType <CareerManager>();
            }
            break;

        case 2:
            if (fwScr == null)
            {
                fwScr = FindObjectOfType <FireworkScript>();
            }
            if (molnia == null)
            {
                molnia = FindObjectOfType <LighteningScript>();
            }
            if (practScr == null)
            {
                practScr = FindObjectOfType <Practice>();
            }
            if (timFr == null)
            {
                timFr = FindObjectOfType <TimeFreeze>();
            }
            if (rainMan == null)
            {
                rainMan = FindObjectOfType <RainManager>();
            }
            if (bonObjMan == null)
            {
                bonObjMan = FindObjectOfType <BonusObjManager>();
            }
            if (enOrDis == null)
            {
                enOrDis = FindObjectOfType <EnableOrDisable>();
            }
            if (monWin == null)
            {
                monWin = FindObjectOfType <MoneyWinScript>();
            }
            if (camSize == null)
            {
                camSize = FindObjectOfType <CameraSize>();
            }
            if (colCorr == null)
            {
                colCorr = FindObjectOfType <ColorCorrectionControl>();
            }
            if (marks == null)
            {
                marks = FindObjectOfType <Markers>();
            }
            if (goalPanScr == null)
            {
                goalPanScr = FindObjectOfType <GoalPanelScript>();
            }
            if (objLev == null)
            {
                objLev = FindObjectOfType <Objects_Level>();
            }
            if (scoreScr == null)
            {
                scoreScr = FindObjectOfType <Score>();
            }
            if (pMov == null)
            {
                pMov = FindObjectOfType <PlayerMovement>();
            }
            if (tM == null)
            {
                tM = FindObjectOfType <TimeManager>();
            }
            if (ballScr == null)
            {
                ballScr = FindObjectOfType <BallScript>();
            }
            if (grTr == null)
            {
                grTr = FindObjectOfType <GroundTrigger1>();
            }
            if (congrPan == null)
            {
                congrPan = FindObjectOfType <CongradulationsPanel>();
            }
            if (levAudScr == null)
            {
                levAudScr = FindObjectOfType <LevelAudioScript>();
            }
            if (stChScr == null)
            {
                stChScr = FindObjectOfType <StadiumChooseScript>();
            }
            if (ballTScr == null)
            {
                ballTScr = FindObjectOfType <BallTouchScript>();
            }
            if (jScr == null)
            {
                jScr = FindObjectOfType <JumpScript>();
            }
            if (skyScr == null)
            {
                skyScr = FindObjectOfType <SkyScript>();
            }
            //if (enAlg == null) enAlg = FindObjectOfType<Enemy>();
            break;
        }
    }
 void Start()
 {
     rain = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<RainManager>();
     animator = gameObject.GetComponent<Animator>();
 }
Example #29
0
    public void UpdateProcessing()
    {
        if (!ItemsManager.Get())
        {
            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;
        }
        foreach (ItemSlot itemSlot in this.m_ActiveSlots)
        {
            Food food = (Food)itemSlot.m_Item;
            if (this.m_Firecamp)
            {
                if (!this.m_Firecamp.m_Burning)
                {
                    if (food.m_ProcessDuration > 0f)
                    {
                        food.m_ProcessDuration -= num;
                    }
                    else
                    {
                        food.m_ProcessDuration = 0f;
                    }
                    if (!itemSlot.gameObject.activeSelf)
                    {
                        itemSlot.gameObject.SetActive(true);
                    }
                    if (!itemSlot.m_Item.enabled)
                    {
                        itemSlot.m_Item.enabled = true;
                        continue;
                    }
                    continue;
                }
            }
            else if (this.m_Type != FoodProcessor.Type.Dryer && (!this.m_ConnectedFirecamp || !this.m_ConnectedFirecamp.m_Burning))
            {
                if (food.m_ProcessDuration > 0f)
                {
                    food.m_ProcessDuration -= num;
                }
                else
                {
                    food.m_ProcessDuration = 0f;
                }
                if (!itemSlot.gameObject.activeSelf)
                {
                    itemSlot.gameObject.SetActive(true);
                }
                if (!itemSlot.m_Item.enabled)
                {
                    itemSlot.m_Item.enabled = true;
                    continue;
                }
                continue;
            }
            if (this.m_Type == FoodProcessor.Type.Dryer)
            {
                if (!RainManager.Get().IsRain() || RainManager.Get().IsInRainCutter(base.transform.position))
                {
                    food.m_ProcessDuration += num;
                }
                else if (food.m_ProcessDuration > 0f)
                {
                    food.m_ProcessDuration -= num;
                }
                else
                {
                    food.m_ProcessDuration = 0f;
                }
            }
            else
            {
                food.m_ProcessDuration += num;
            }
            FoodInfo foodInfo = (FoodInfo)itemSlot.m_Item.m_Info;
            if (food.m_ProcessDuration >= this.GetProcessingTime(foodInfo) || this.m_DebugImmediate)
            {
                HUDProcess.Get().UnregisterProcess(itemSlot.m_Item);
                Item item = ItemsManager.Get().CreateItem(this.GetResultItemID(foodInfo), true, itemSlot.m_Item.transform.position, itemSlot.m_Item.transform.rotation);
                itemSlot.ReplaceItem(item);
                if (!this.m_ProcessedSlots.Contains(itemSlot))
                {
                    this.m_ProcessedSlots.Add(itemSlot);
                }
                this.m_DebugImmediate = false;
                if (this.m_Type == FoodProcessor.Type.Fire && !foodInfo.m_CanCook)
                {
                    food.m_Burned = true;
                    break;
                }
                break;
            }
        }
    }
Example #30
0
 private void UpdateFog()
 {
     if (FogSensor.s_NumEnters > 0)
     {
         RenderSettings.fogStartDistance += (FogSensor.s_FogDensityStart - RenderSettings.fogStartDistance) * Time.deltaTime;
         RenderSettings.fogEndDistance   += (FogSensor.s_FogDensityEnd - RenderSettings.fogEndDistance) * Time.deltaTime;
     }
     else
     {
         float proportionalClamp = CJTools.Math.GetProportionalClamp(this.m_FogStartDistance, 10f, RainManager.Get().m_WeatherInterpolated, 0f, 1f);
         RenderSettings.fogStartDistance += (proportionalClamp - RenderSettings.fogStartDistance) * Time.deltaTime;
         proportionalClamp              = CJTools.Math.GetProportionalClamp(this.m_FogEndDistance, 150f, RainManager.Get().m_WeatherInterpolated, 0f, 1f);
         RenderSettings.fogEndDistance += (proportionalClamp - RenderSettings.fogEndDistance) * Time.deltaTime;
     }
 }
Example #31
0
    public void UpdateInternal()
    {
        if (this.m_GrownPlant)
        {
            AcreRespawnFruits component = this.m_GrownPlant.GetComponent <AcreRespawnFruits>();
            if (component)
            {
                component.UpdateInternal();
            }
        }
        float num = Time.deltaTime;

        if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
        {
            num = Player.GetSleepTimeFactor();
        }
        if (RainManager.Get().IsRain())
        {
            this.m_WaterAmount += this.m_FillSpeed * num;
        }
        else if (this.m_ItemId == ItemID.None)
        {
            this.m_WaterAmount -= this.m_DrySpeed * num;
        }
        else
        {
            this.m_WaterAmount -= ItemsManager.Get().GetInfo(this.m_ItemId).m_AcreDehydration *num;
        }
        this.m_WaterAmount = Mathf.Clamp(this.m_WaterAmount, 0f, this.m_MaxWaterAmount);
        if (this.m_ItemId != ItemID.None)
        {
            this.m_FertilizerAmount -= ItemsManager.Get().GetInfo(this.m_ItemId).m_AcreDefertilization *num;
            this.m_FertilizerAmount  = Mathf.Clamp(this.m_FertilizerAmount, 0f, this.m_MaxFertilizerAmount);
        }
        this.UpdateShaderProperties();
        float currentTimeMinutes = MainLevel.Instance.GetCurrentTimeMinutes();

        if (!this.m_Plant || this.m_AcreState != AcreState.Growing || this.m_WaterAmount <= 0f)
        {
            this.m_LastUpdateTIme = currentTimeMinutes;
            return;
        }
        bool  flag = false;
        float num2 = this.m_Plant.transform.localScale.x;
        float num3 = 1f;

        this.m_NumBuffs = 0;
        if (this.m_WaterAmount > 50f)
        {
            num3 = 1.2f;
            this.m_NumBuffs++;
        }
        float num4 = 1f;

        if (this.m_FertilizerAmount / this.m_MaxFertilizerAmount > 0.5f)
        {
            num4             = 1.4f;
            this.m_NumBuffs += 2;
        }
        else if (this.m_FertilizerAmount / this.m_MaxFertilizerAmount > 0.01f)
        {
            num4 = 1.2f;
            this.m_NumBuffs++;
        }
        if (this.m_WaterAmount > 0f)
        {
            num2 += (currentTimeMinutes - this.m_LastUpdateTIme) / this.m_TimeToGrow * (num4 * num3);
        }
        if (num2 >= 1f)
        {
            flag = true;
        }
        num2 = Mathf.Clamp01(num2);
        Vector3 one = Vector3.one;

        one.Set(num2, num2, num2);
        if (this.m_Plant)
        {
            this.m_Plant.transform.localScale = one;
        }
        if (flag)
        {
            this.SetState(AcreState.Grown);
        }
        this.m_LastUpdateTIme = currentTimeMinutes;
    }
Example #32
0
 private void OnDisable()
 {
     RainManager.Get().UnregisterRainCutter(this);
     this.m_RequestRegister = false;
 }