Exemple #1
0
 // Token: 0x06000A21 RID: 2593 RVA: 0x00049640 File Offset: 0x00047840
 private void UpdateAmbientMusic(Heightmap.Biome biome, EnvSetup currentEnv, float dt)
 {
     this.m_ambientMusicTimer += dt;
     if (this.m_ambientMusicTimer > 2f)
     {
         this.m_ambientMusicTimer = 0f;
         this.m_ambientMusic      = null;
         BiomeEnvSetup biomeEnvSetup = this.GetBiomeEnvSetup(biome);
         if (this.IsDay())
         {
             if (currentEnv.m_musicDay.Length > 0)
             {
                 this.m_ambientMusic = currentEnv.m_musicDay;
                 return;
             }
             if (biomeEnvSetup.m_musicDay.Length > 0)
             {
                 this.m_ambientMusic = biomeEnvSetup.m_musicDay;
                 return;
             }
         }
         else
         {
             if (currentEnv.m_musicNight.Length > 0)
             {
                 this.m_ambientMusic = currentEnv.m_musicNight;
                 return;
             }
             if (biomeEnvSetup.m_musicNight.Length > 0)
             {
                 this.m_ambientMusic = biomeEnvSetup.m_musicNight;
             }
         }
     }
 }
Exemple #2
0
        public static void EnvMan_Awake()
        {
            EnvSetup basementEnv = EnvMan.instance.m_environments.Find(x => x.m_name == "Crypt").Clone();

            basementEnv.m_name = "Basement";
            EnvMan.instance.m_environments.Add(basementEnv);
        }
Exemple #3
0
    // Token: 0x060009FA RID: 2554 RVA: 0x000483E4 File Offset: 0x000465E4
    private AudioClip SelectRandomAmbientClip()
    {
        if (EnvMan.instance == null)
        {
            return(null);
        }
        EnvSetup currentEnvironment = EnvMan.instance.GetCurrentEnvironment();

        AudioMan.BiomeAmbients biomeAmbients;
        if (currentEnvironment != null && !string.IsNullOrEmpty(currentEnvironment.m_ambientList))
        {
            biomeAmbients = this.GetAmbients(currentEnvironment.m_ambientList);
        }
        else
        {
            biomeAmbients = this.GetBiomeAmbients(EnvMan.instance.GetCurrentBiome());
        }
        if (biomeAmbients == null)
        {
            return(null);
        }
        List <AudioClip> list       = new List <AudioClip>(biomeAmbients.m_randomAmbientClips);
        List <AudioClip> collection = EnvMan.instance.IsDaylight() ? biomeAmbients.m_randomAmbientClipsDay : biomeAmbients.m_randomAmbientClipsNight;

        list.AddRange(collection);
        if (list.Count == 0)
        {
            return(null);
        }
        return(list[UnityEngine.Random.Range(0, list.Count)]);
    }
    void Start()
    {
        academyAgent = GameObject.Find("EnvSetup").GetComponent <EnvSetup>();
        isTraining   = academyAgent.TrainingCheck();

        kinectRecorder    = new GameObjectRecorder(kinectAvatar);
        leapLeftRecorder  = new GameObjectRecorder(leapHandLeft);
        leapRightRecorder = new GameObjectRecorder(leapHandRight);

        // Initiate dropdown options
        if (!isTraining)
        {
            recInfo           = GameObject.Find("recInfo").GetComponent <Text>();
            recorderName      = GameObject.Find("recorder").GetComponent <InputField>();
            recStartEnd       = GameObject.Find("recStartEnd").GetComponent <Button>();
            recSave           = GameObject.Find("recSave").GetComponent <Button>();
            targetDropdown    = GameObject.Find("target").GetComponent <Dropdown>();
            targetNumDropdown = GameObject.Find("targetNum").GetComponent <Dropdown>();
            LeftRight         = GameObject.Find("handGroup/left").GetComponent <Toggle>();
            TrainTest         = GameObject.Find("train").GetComponent <Toggle>();

            // targetDropdown.ClearOptions();
            targetNumDropdown.ClearOptions();
            // targetDropdown.AddOptions(Enum.GetNames(typeof(EnvSetup.targets)).ToList());
            targetNumDropdown.AddOptions(Enumerable.Range(0, 10).Select(num => num.ToString()).ToList());
        }
    }
Exemple #5
0
    // Token: 0x06000A28 RID: 2600 RVA: 0x00049964 File Offset: 0x00047B64
    private void UpdateEnvironment(long sec, Heightmap.Biome biome)
    {
        string environmentOverride = this.GetEnvironmentOverride();

        if (!string.IsNullOrEmpty(environmentOverride))
        {
            this.m_environmentPeriod = -1L;
            this.m_currentBiome      = this.GetBiome();
            this.QueueEnvironment(environmentOverride);
            return;
        }
        long num = sec / this.m_environmentDuration;

        if (this.m_environmentPeriod != num || this.m_currentBiome != biome)
        {
            this.m_environmentPeriod = num;
            this.m_currentBiome      = biome;
            UnityEngine.Random.State state = UnityEngine.Random.state;
            UnityEngine.Random.InitState((int)num);
            List <EnvEntry> availableEnvironments = this.GetAvailableEnvironments(biome);
            if (availableEnvironments != null && availableEnvironments.Count > 0)
            {
                EnvSetup env = this.SelectWeightedEnvironment(availableEnvironments);
                this.QueueEnvironment(env);
            }
            UnityEngine.Random.state = state;
        }
    }
Exemple #6
0
 // Token: 0x06000A2E RID: 2606 RVA: 0x00049BAF File Offset: 0x00047DAF
 private void QueueEnvironment(EnvSetup env)
 {
     if (this.m_firstEnv)
     {
         this.m_firstEnv   = false;
         this.m_currentEnv = env;
         return;
     }
     this.m_prevEnv         = this.m_currentEnv.Clone();
     this.m_nextEnv         = env;
     this.m_transitionTimer = 0f;
 }
Exemple #7
0
 // Token: 0x06000A3E RID: 2622 RVA: 0x0004A6EC File Offset: 0x000488EC
 public EnvSetup GetCurrentEnvironment()
 {
     if (!string.IsNullOrEmpty(this.m_forceEnv))
     {
         EnvSetup env = this.GetEnv(this.m_forceEnv);
         if (env != null)
         {
             return(env);
         }
     }
     return(this.m_currentEnv);
 }
Exemple #8
0
        private static void Prefix(ref EnvMan __instance, ref EnvSetup env)
        {
            if (Configuration.Current.Game.IsEnabled && Configuration.Current.Game.disableFog)
            {
                env.m_fogDensityNight   = 0.0001f;
                env.m_fogDensityMorning = 0.0001f;
                env.m_fogDensityDay     = 0.0001f;
                env.m_fogDensityEvening = 0.0001f;
            }

            if (Configuration.Current.Brightness.IsEnabled)
            {
                applyEnvModifier(env);
            }
        }
Exemple #9
0
        public static void FindAndCopyEnvObjectByName(EnvMan envMan, string name, EnvSetup targetEnv)
        {
            if (targetEnv.m_envObject.name == name)
            {
                return;
            }

            foreach (var env in envMan.m_environments)
            {
                if (env.m_envObject.name.Equals(name))
                {
                    targetEnv.m_envObject = env.m_envObject;
                    return;
                }
            }
        }
Exemple #10
0
 // Token: 0x06000A4B RID: 2635 RVA: 0x0004A900 File Offset: 0x00048B00
 private void UpdateWind(long timeSec, float dt)
 {
     if (this.m_debugWind)
     {
         float   f   = 0.017453292f * this.m_debugWindAngle;
         Vector3 dir = new Vector3(Mathf.Sin(f), 0f, Mathf.Cos(f));
         this.SetTargetWind(dir, this.m_debugWindIntensity);
     }
     else
     {
         EnvSetup currentEnvironment = this.GetCurrentEnvironment();
         if (currentEnvironment != null)
         {
             UnityEngine.Random.State state = UnityEngine.Random.state;
             float f2  = 0f;
             float num = 0.5f;
             this.AddWindOctave(timeSec, 1, ref f2, ref num);
             this.AddWindOctave(timeSec, 2, ref f2, ref num);
             this.AddWindOctave(timeSec, 4, ref f2, ref num);
             this.AddWindOctave(timeSec, 8, ref f2, ref num);
             UnityEngine.Random.state = state;
             Vector3 dir2 = new Vector3(Mathf.Sin(f2), 0f, Mathf.Cos(f2));
             num = Mathf.Lerp(currentEnvironment.m_windMin, currentEnvironment.m_windMax, num);
             if (Player.m_localPlayer)
             {
                 float magnitude = Player.m_localPlayer.transform.position.magnitude;
                 if (magnitude > 10500f - this.m_edgeOfWorldWidth)
                 {
                     float num2 = Utils.LerpStep(10500f - this.m_edgeOfWorldWidth, 10500f, magnitude);
                     num2 = 1f - Mathf.Pow(1f - num2, 2f);
                     dir2 = Player.m_localPlayer.transform.position.normalized;
                     num  = Mathf.Lerp(num, 1f, num2);
                 }
                 else
                 {
                     Ship localShip = Ship.GetLocalShip();
                     if (localShip && localShip.IsWindControllActive())
                     {
                         dir2 = localShip.transform.forward;
                     }
                 }
             }
             this.SetTargetWind(dir2, num);
         }
     }
     this.UpdateWindTransition(dt);
 }
Exemple #11
0
    // Token: 0x06000A1E RID: 2590 RVA: 0x00049338 File Offset: 0x00047538
    private void FixedUpdate()
    {
        this.UpdateTimeSkip(Time.fixedDeltaTime);
        this.m_totalSeconds = ZNet.instance.GetTimeSeconds();
        long   num  = (long)this.m_totalSeconds;
        double num2 = this.m_totalSeconds * 1000.0;
        long   num3 = this.m_dayLengthSec * 1000L;
        float  num4 = Mathf.Clamp01((float)(num2 % (double)num3 / 1000.0) / (float)this.m_dayLengthSec);

        num4 = this.RescaleDayFraction(num4);
        float smoothDayFraction = this.m_smoothDayFraction;
        float t = Mathf.LerpAngle(this.m_smoothDayFraction * 360f, num4 * 360f, 0.01f);

        this.m_smoothDayFraction = Mathf.Repeat(t, 360f) / 360f;
        if (this.m_debugTimeOfDay)
        {
            this.m_smoothDayFraction = this.m_debugTime;
        }
        float num5 = Mathf.Pow(Mathf.Max(1f - Mathf.Clamp01(this.m_smoothDayFraction / 0.25f), Mathf.Clamp01((this.m_smoothDayFraction - 0.75f) / 0.25f)), 0.5f);
        float num6 = Mathf.Pow(Mathf.Clamp01(1f - Mathf.Abs(this.m_smoothDayFraction - 0.5f) / 0.25f), 0.5f);
        float num7 = Mathf.Min(Mathf.Clamp01(1f - (this.m_smoothDayFraction - 0.26f) / -this.m_sunHorizonTransitionL), Mathf.Clamp01(1f - (this.m_smoothDayFraction - 0.26f) / this.m_sunHorizonTransitionH));
        float num8 = Mathf.Min(Mathf.Clamp01(1f - (this.m_smoothDayFraction - 0.74f) / -this.m_sunHorizonTransitionH), Mathf.Clamp01(1f - (this.m_smoothDayFraction - 0.74f) / this.m_sunHorizonTransitionL));
        float num9 = 1f / (num5 + num6 + num7 + num8);

        num5 *= num9;
        num6 *= num9;
        num7 *= num9;
        num8 *= num9;
        Heightmap.Biome biome = this.GetBiome();
        this.UpdateTriggers(smoothDayFraction, this.m_smoothDayFraction, biome, Time.fixedDeltaTime);
        this.UpdateEnvironment(num, biome);
        this.InterpolateEnvironment(Time.fixedDeltaTime);
        this.UpdateWind(num, Time.fixedDeltaTime);
        if (!string.IsNullOrEmpty(this.m_forceEnv))
        {
            EnvSetup env = this.GetEnv(this.m_forceEnv);
            if (env != null)
            {
                this.SetEnv(env, num6, num5, num7, num8, Time.fixedDeltaTime);
                return;
            }
        }
        else
        {
            this.SetEnv(this.m_currentEnv, num6, num5, num7, num8, Time.fixedDeltaTime);
        }
    }
Exemple #12
0
    // Token: 0x06000A2D RID: 2605 RVA: 0x00049B60 File Offset: 0x00047D60
    private void QueueEnvironment(string name)
    {
        if (this.m_currentEnv.m_name == name)
        {
            return;
        }
        if (this.m_nextEnv != null && this.m_nextEnv.m_name == name)
        {
            return;
        }
        EnvSetup env = this.GetEnv(name);

        if (env != null)
        {
            this.QueueEnvironment(env);
        }
    }
Exemple #13
0
    // Token: 0x06000A2F RID: 2607 RVA: 0x00049BEC File Offset: 0x00047DEC
    private EnvSetup InterpolateEnvironment(EnvSetup a, EnvSetup b, float i)
    {
        EnvSetup envSetup = a.Clone();

        envSetup.m_name = b.m_name;
        if (i >= 0.5f)
        {
            envSetup.m_isFreezingAtNight = b.m_isFreezingAtNight;
            envSetup.m_isFreezing        = b.m_isFreezing;
            envSetup.m_isCold            = b.m_isCold;
            envSetup.m_isColdAtNight     = b.m_isColdAtNight;
            envSetup.m_isColdAtNight     = b.m_isColdAtNight;
        }
        envSetup.m_ambColorDay         = Color.Lerp(a.m_ambColorDay, b.m_ambColorDay, i);
        envSetup.m_ambColorNight       = Color.Lerp(a.m_ambColorNight, b.m_ambColorNight, i);
        envSetup.m_fogColorDay         = Color.Lerp(a.m_fogColorDay, b.m_fogColorDay, i);
        envSetup.m_fogColorEvening     = Color.Lerp(a.m_fogColorEvening, b.m_fogColorEvening, i);
        envSetup.m_fogColorMorning     = Color.Lerp(a.m_fogColorMorning, b.m_fogColorMorning, i);
        envSetup.m_fogColorNight       = Color.Lerp(a.m_fogColorNight, b.m_fogColorNight, i);
        envSetup.m_fogColorSunDay      = Color.Lerp(a.m_fogColorSunDay, b.m_fogColorSunDay, i);
        envSetup.m_fogColorSunEvening  = Color.Lerp(a.m_fogColorSunEvening, b.m_fogColorSunEvening, i);
        envSetup.m_fogColorSunMorning  = Color.Lerp(a.m_fogColorSunMorning, b.m_fogColorSunMorning, i);
        envSetup.m_fogColorSunNight    = Color.Lerp(a.m_fogColorSunNight, b.m_fogColorSunNight, i);
        envSetup.m_fogDensityDay       = Mathf.Lerp(a.m_fogDensityDay, b.m_fogDensityDay, i);
        envSetup.m_fogDensityEvening   = Mathf.Lerp(a.m_fogDensityEvening, b.m_fogDensityEvening, i);
        envSetup.m_fogDensityMorning   = Mathf.Lerp(a.m_fogDensityMorning, b.m_fogDensityMorning, i);
        envSetup.m_fogDensityNight     = Mathf.Lerp(a.m_fogDensityNight, b.m_fogDensityNight, i);
        envSetup.m_sunColorDay         = Color.Lerp(a.m_sunColorDay, b.m_sunColorDay, i);
        envSetup.m_sunColorEvening     = Color.Lerp(a.m_sunColorEvening, b.m_sunColorEvening, i);
        envSetup.m_sunColorMorning     = Color.Lerp(a.m_sunColorMorning, b.m_sunColorMorning, i);
        envSetup.m_sunColorNight       = Color.Lerp(a.m_sunColorNight, b.m_sunColorNight, i);
        envSetup.m_lightIntensityDay   = Mathf.Lerp(a.m_lightIntensityDay, b.m_lightIntensityDay, i);
        envSetup.m_lightIntensityNight = Mathf.Lerp(a.m_lightIntensityNight, b.m_lightIntensityNight, i);
        envSetup.m_sunAngle            = Mathf.Lerp(a.m_sunAngle, b.m_sunAngle, i);
        envSetup.m_windMin             = Mathf.Lerp(a.m_windMin, b.m_windMin, i);
        envSetup.m_windMax             = Mathf.Lerp(a.m_windMax, b.m_windMax, i);
        envSetup.m_rainCloudAlpha      = Mathf.Lerp(a.m_rainCloudAlpha, b.m_rainCloudAlpha, i);
        envSetup.m_ambientLoop         = ((i > 0.75f) ? b.m_ambientLoop : a.m_ambientLoop);
        envSetup.m_ambientVol          = ((i > 0.75f) ? b.m_ambientVol : a.m_ambientVol);
        envSetup.m_musicEvening        = b.m_musicEvening;
        envSetup.m_musicMorning        = b.m_musicMorning;
        envSetup.m_musicDay            = b.m_musicDay;
        envSetup.m_musicNight          = b.m_musicNight;
        return(envSetup);
    }
Exemple #14
0
    // Token: 0x06000A24 RID: 2596 RVA: 0x00049788 File Offset: 0x00047988
    private void OnEvening(Heightmap.Biome biome, EnvSetup currentEnv)
    {
        string name = "evening";

        if (currentEnv.m_musicEvening.Length > 0)
        {
            name = currentEnv.m_musicEvening;
        }
        else
        {
            BiomeEnvSetup biomeEnvSetup = this.GetBiomeEnvSetup(biome);
            if (biomeEnvSetup.m_musicEvening.Length > 0)
            {
                name = biomeEnvSetup.m_musicEvening;
            }
        }
        MusicMan.instance.TriggerMusic(name);
    }
Exemple #15
0
        public static void FindAndCopyPsystemByName(EnvMan envMan, string name, EnvSetup targetEnv)
        {
            if (targetEnv.m_psystems.ToList().Exists(x => x.name == name))
            {
                return;
            }

            foreach (var env in envMan.m_environments)
            {
                foreach (var psystem in env.m_psystems)
                {
                    if (psystem.name.Equals(name))
                    {
                        targetEnv.m_psystems = targetEnv.m_psystems.AddToArray(psystem);
                        return;
                    }
                }
            }
        }
Exemple #16
0
            //note: supported types of parameters for an RPCS call are based on types specified in Zrpc Serializable, so you can't just use things like EnvSetup as a parameter by default...
            public static void RPC_QueueEnvironment(long senderId, string weather)
            {
                int selectedWeatherIndex = GetWeatherIndex(weather);

                Plugin.LogVerbose($"RPC_QueueEnvironment for: {weather}");

                if (selectedWeatherIndex != -1)
                {
                    // get the new weather envsetup
                    EnvSetup newEnvironment = EnvMan.instance.GetEnv(environmentNames[selectedWeatherIndex]);
                    if (null != newEnvironment)
                    {
                        //envMan.QueueEnvironment(newEnvironment);
                        Plugin.LogVerbose($"Calling QueueEnvironment for: {weather}");
                        EnvMan.instance.QueueEnvironment(newEnvironment);
                        return;
                    }
                }

                Plugin.LogVerbose($"RPC_QueueEnvironment: {weather} not found");
            }
Exemple #17
0
        private static void applyEnvModifier(EnvSetup env)
        {
            /* changing brightness during a period of day had a coupling affect with other period, need further development
             * env.m_fogColorMorning = applyBrightnessModifier(env.m_fogColorMorning, Configuration.Current.Brightness.morningBrightnessMultiplier);
             * env.m_fogColorSunMorning = applyBrightnessModifier(env.m_fogColorSunMorning, Configuration.Current.Brightness.morningBrightnessMultiplier);
             * env.m_sunColorMorning = applyBrightnessModifier(env.m_sunColorMorning, Configuration.Current.Brightness.morningBrightnessMultiplier);
             *
             * env.m_ambColorDay = applyBrightnessModifier(env.m_ambColorDay, Configuration.Current.Brightness.dayBrightnessMultiplier);
             * env.m_fogColorDay = applyBrightnessModifier(env.m_fogColorDay, Configuration.Current.Brightness.dayBrightnessMultiplier);
             * env.m_fogColorSunDay = applyBrightnessModifier(env.m_fogColorSunDay, Configuration.Current.Brightness.dayBrightnessMultiplier);
             * env.m_sunColorDay = applyBrightnessModifier(env.m_sunColorDay, Configuration.Current.Brightness.dayBrightnessMultiplier);
             *
             * env.m_fogColorEvening = applyBrightnessModifier(env.m_fogColorEvening, Configuration.Current.Brightness.eveningBrightnessMultiplier);
             * env.m_fogColorSunEvening = applyBrightnessModifier(env.m_fogColorSunEvening, Configuration.Current.Brightness.eveningBrightnessMultiplier);
             * env.m_sunColorEvening = applyBrightnessModifier(env.m_sunColorEvening, Configuration.Current.Brightness.eveningBrightnessMultiplier);
             */

            env.m_ambColorNight    = applyBrightnessModifier(env.m_ambColorNight, Configuration.Current.Brightness.nightBrightnessMultiplier);
            env.m_fogColorNight    = applyBrightnessModifier(env.m_fogColorNight, Configuration.Current.Brightness.nightBrightnessMultiplier);
            env.m_fogColorSunNight = applyBrightnessModifier(env.m_fogColorSunNight, Configuration.Current.Brightness.nightBrightnessMultiplier);
            env.m_sunColorNight    = applyBrightnessModifier(env.m_sunColorNight, Configuration.Current.Brightness.nightBrightnessMultiplier);
        }
Exemple #18
0
    // Token: 0x06000A20 RID: 2592 RVA: 0x000495BC File Offset: 0x000477BC
    private void UpdateTriggers(float oldDayFraction, float newDayFraction, Heightmap.Biome biome, float dt)
    {
        if (Player.m_localPlayer == null || biome == Heightmap.Biome.None)
        {
            return;
        }
        EnvSetup currentEnvironment = this.GetCurrentEnvironment();

        if (currentEnvironment == null)
        {
            return;
        }
        this.UpdateAmbientMusic(biome, currentEnvironment, dt);
        if (oldDayFraction > 0.2f && oldDayFraction < 0.25f && newDayFraction > 0.25f && newDayFraction < 0.3f)
        {
            this.OnMorning(biome, currentEnvironment);
        }
        if (oldDayFraction > 0.7f && oldDayFraction < 0.75f && newDayFraction > 0.75f && newDayFraction < 0.8f)
        {
            this.OnEvening(biome, currentEnvironment);
        }
    }
Exemple #19
0
    // Token: 0x06000A23 RID: 2595 RVA: 0x00049700 File Offset: 0x00047900
    private void OnMorning(Heightmap.Biome biome, EnvSetup currentEnv)
    {
        string name = "morning";

        if (currentEnv.m_musicMorning.Length > 0)
        {
            name = currentEnv.m_musicMorning;
        }
        else
        {
            BiomeEnvSetup biomeEnvSetup = this.GetBiomeEnvSetup(biome);
            if (biomeEnvSetup.m_musicMorning.Length > 0)
            {
                name = biomeEnvSetup.m_musicMorning;
            }
        }
        MusicMan.instance.TriggerMusic(name);
        Player.m_localPlayer.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_newday", new string[]
        {
            this.GetCurrentDay().ToString()
        }), 0, null);
    }
Exemple #20
0
        public static void AddHelheimEnvironments(EnvMan envMan, EnvSetup baseEnv, int level)
        {
            var helheimEnvBase = baseEnv.Clone();

            helheimEnvBase.m_name = GetHelheimEnvName(level, false, false);
            //FindAndCopyEnvObjectByName(envMan, "Thunder", helheimEnvBase);
            envMan.m_environments.Add(helheimEnvBase);

            var helheimEnvWet = helheimEnvBase.Clone();

            helheimEnvWet.m_name  = GetHelheimEnvName(level, true, false);
            helheimEnvWet.m_isWet = true;
            FindAndCopyPsystemByName(envMan, level == 1 ? "LightRain" : "Rain", helheimEnvWet);
            envMan.m_environments.Add(helheimEnvWet);

            var helheimEnvFreezing = helheimEnvBase.Clone();

            helheimEnvFreezing.m_name       = GetHelheimEnvName(level, false, true);
            helheimEnvFreezing.m_isFreezing = true;
            FindAndCopyPsystemByName(envMan, level == 1 ? "Snow" : "SnowStorm", helheimEnvFreezing);
            envMan.m_environments.Add(helheimEnvFreezing);
        }
Exemple #21
0
    // Token: 0x06000A41 RID: 2625 RVA: 0x0004A790 File Offset: 0x00048990
    public bool IsWet()
    {
        EnvSetup currentEnvironment = this.GetCurrentEnvironment();

        return(currentEnvironment != null && currentEnvironment.m_isWet);
    }
Exemple #22
0
    // Token: 0x06000A40 RID: 2624 RVA: 0x0004A758 File Offset: 0x00048958
    public bool IsCold()
    {
        EnvSetup currentEnvironment = this.GetCurrentEnvironment();

        return(currentEnvironment != null && (currentEnvironment.m_isCold || (currentEnvironment.m_isColdAtNight && !this.IsDay())));
    }
Exemple #23
0
    // Token: 0x06000A3F RID: 2623 RVA: 0x0004A720 File Offset: 0x00048920
    public bool IsFreezing()
    {
        EnvSetup currentEnvironment = this.GetCurrentEnvironment();

        return(currentEnvironment != null && (currentEnvironment.m_isFreezing || (currentEnvironment.m_isFreezingAtNight && !this.IsDay())));
    }
Exemple #24
0
        public static EnvSetup GetHelheimEnvironment(EnvMan envMan, EnvSetup biomeEnv, int level)
        {
            var name = GetHelheimEnvName(level, biomeEnv.m_isWet, biomeEnv.m_isFreezing);

            return(envMan.GetEnv(name));
        }
Exemple #25
0
    // Token: 0x06000A3D RID: 2621 RVA: 0x0004A6CC File Offset: 0x000488CC
    public bool IsEnvironment(List <string> names)
    {
        EnvSetup currentEnvironment = this.GetCurrentEnvironment();

        return(names.Contains(currentEnvironment.m_name));
    }
Exemple #26
0
    // Token: 0x06000A3A RID: 2618 RVA: 0x0004A688 File Offset: 0x00048888
    public bool IsDaylight()
    {
        EnvSetup currentEnvironment = this.GetCurrentEnvironment();

        return((currentEnvironment == null || !currentEnvironment.m_alwaysDark) && this.IsDay());
    }
Exemple #27
0
    // Token: 0x06000A30 RID: 2608 RVA: 0x00049EFC File Offset: 0x000480FC
    private void SetEnv(EnvSetup env, float dayInt, float nightInt, float morningInt, float eveningInt, float dt)
    {
        Camera mainCamera = Utils.GetMainCamera();

        if (mainCamera == null)
        {
            return;
        }
        this.m_dirLight.transform.rotation = Quaternion.Euler(-90f + env.m_sunAngle, 0f, 0f) * Quaternion.Euler(0f, -90f, 0f) * Quaternion.Euler(-90f + 360f * this.m_smoothDayFraction, 0f, 0f);
        Vector3 v = -this.m_dirLight.transform.forward;

        this.m_dirLight.intensity  = env.m_lightIntensityDay * dayInt;
        this.m_dirLight.intensity += env.m_lightIntensityNight * nightInt;
        if (nightInt > 0f)
        {
            this.m_dirLight.transform.rotation = this.m_dirLight.transform.rotation * Quaternion.Euler(180f, 0f, 0f);
        }
        this.m_dirLight.transform.position = mainCamera.transform.position - this.m_dirLight.transform.forward * 3000f;
        this.m_dirLight.color  = new Color(0f, 0f, 0f, 0f);
        this.m_dirLight.color += env.m_sunColorNight * nightInt;
        if (dayInt > 0f)
        {
            this.m_dirLight.color += env.m_sunColorDay * dayInt;
            this.m_dirLight.color += env.m_sunColorMorning * morningInt;
            this.m_dirLight.color += env.m_sunColorEvening * eveningInt;
        }
        RenderSettings.fogColor  = new Color(0f, 0f, 0f, 0f);
        RenderSettings.fogColor += env.m_fogColorNight * nightInt;
        RenderSettings.fogColor += env.m_fogColorDay * dayInt;
        RenderSettings.fogColor += env.m_fogColorMorning * morningInt;
        RenderSettings.fogColor += env.m_fogColorEvening * eveningInt;
        this.m_sunFogColor       = new Color(0f, 0f, 0f, 0f);
        this.m_sunFogColor      += env.m_fogColorSunNight * nightInt;
        if (dayInt > 0f)
        {
            this.m_sunFogColor += env.m_fogColorSunDay * dayInt;
            this.m_sunFogColor += env.m_fogColorSunMorning * morningInt;
            this.m_sunFogColor += env.m_fogColorSunEvening * eveningInt;
        }
        this.m_sunFogColor          = Color.Lerp(RenderSettings.fogColor, this.m_sunFogColor, Mathf.Clamp01(Mathf.Max(nightInt, dayInt) * 3f));
        RenderSettings.fogDensity   = 0f;
        RenderSettings.fogDensity  += env.m_fogDensityNight * nightInt;
        RenderSettings.fogDensity  += env.m_fogDensityDay * dayInt;
        RenderSettings.fogDensity  += env.m_fogDensityMorning * morningInt;
        RenderSettings.fogDensity  += env.m_fogDensityEvening * eveningInt;
        RenderSettings.ambientMode  = AmbientMode.Flat;
        RenderSettings.ambientLight = Color.Lerp(env.m_ambColorNight, env.m_ambColorDay, dayInt);
        SunShafts component = mainCamera.GetComponent <SunShafts>();

        if (component)
        {
            component.sunColor = this.m_dirLight.color;
        }
        if (env.m_envObject != this.m_currentEnvObject)
        {
            if (this.m_currentEnvObject)
            {
                this.m_currentEnvObject.SetActive(false);
                this.m_currentEnvObject = null;
            }
            if (env.m_envObject)
            {
                this.m_currentEnvObject = env.m_envObject;
                this.m_currentEnvObject.SetActive(true);
            }
        }
        if (env.m_psystems != this.m_currentPSystems)
        {
            if (this.m_currentPSystems != null)
            {
                this.SetParticleArrayEnabled(this.m_currentPSystems, false);
                this.m_currentPSystems = null;
            }
            if (env.m_psystems != null && (!env.m_psystemsOutsideOnly || (Player.m_localPlayer && !Player.m_localPlayer.InShelter())))
            {
                this.SetParticleArrayEnabled(env.m_psystems, true);
                this.m_currentPSystems = env.m_psystems;
            }
        }
        this.m_clouds.material.SetFloat(this._Rain, env.m_rainCloudAlpha);
        if (env.m_ambientLoop)
        {
            AudioMan.instance.QueueAmbientLoop(env.m_ambientLoop, env.m_ambientVol);
        }
        else
        {
            AudioMan.instance.StopAmbientLoop();
        }
        Shader.SetGlobalVector(this._SkyboxSunDir, v);
        Shader.SetGlobalVector(this._SkyboxSunDir, v);
        Shader.SetGlobalVector(this._SunDir, -this.m_dirLight.transform.forward);
        Shader.SetGlobalColor(this._SunFogColor, this.m_sunFogColor);
        Shader.SetGlobalColor(this._SunColor, this.m_dirLight.color * this.m_dirLight.intensity);
        Shader.SetGlobalColor(this._AmbientColor, RenderSettings.ambientLight);
        float num = Shader.GetGlobalFloat(this._Wet);

        num = Mathf.MoveTowards(num, env.m_isWet ? 1f : 0f, dt / this.m_wetTransitionDuration);
        Shader.SetGlobalFloat(this._Wet, num);
    }