Beispiel #1
0
        public override void SetTimeOfDay(float timeOfDay)
        {
            base.SetTimeOfDay(timeOfDay);

            if (m_skybox == null)
            {
                return;
            }

            WRoom first_room = null;

            foreach (var node in m_world.Map.SceneList)
            {
                if (node is WRoom)
                {
                    first_room = (WRoom)node;
                    break;
                }
            }

            if (first_room == null || first_room.EnvironmentLighting == null)
            {
                return;
            }

            var envrData = GetChildrenOfType <EnvironmentLightingConditions>();

            var curLight = envrData[0].Lerp(EnvironmentLightingConditions.WeatherPreset.Default, true, timeOfDay);

            m_skybox.SetColors(curLight.SkyboxPalette);
        }
Beispiel #2
0
        public override void SetTimeOfDay(float timeOfDay)
        {
            base.SetTimeOfDay(timeOfDay);

            if (m_skybox == null)
            {
                return;
            }

            WRoom first_room = null;

            foreach (var node in m_world.Map.SceneList)
            {
                if (node is WRoom)
                {
                    first_room = (WRoom)node;
                    break;
                }
            }

            if (first_room == null || first_room.EnvironmentLighting == null)
            {
                return;
            }

            var envrData = GetChildrenOfType <EnvironmentLightingConditions>();

            var curLight = envrData[0].Lerp(EnvironmentLightingConditions.WeatherPreset.Default, true, timeOfDay);

            m_skybox.SetColors(curLight.SkyboxPalette);


            // Set color overrides for certain stage actors that have parameters specifying what room they belong in.
            var childActors = GetChildrenOfType <VisibleDOMNode>();

            foreach (var child in childActors)
            {
                var possibleRoomNums = new List <int>();

                if (child is tbox)
                {
                    var chest = child as tbox;
                    possibleRoomNums.Add(chest.RoomNumber);
                }
                else if (child is door10)
                {
                    var door = child as door10;
                    possibleRoomNums.Add(door.FromRoomNumber);
                    possibleRoomNums.Add(door.ToRoomNumber);
                }
                else if (child is door12)
                {
                    var door = child as door12;
                    possibleRoomNums.Add(door.FromRoomNumber);
                    possibleRoomNums.Add(door.ToRoomNumber);
                }

                if (possibleRoomNums.Count == 0)
                {
                    continue;
                }

                WRoom containingRoom = null;
                foreach (var node in m_world.Map.SceneList)
                {
                    if (node is WRoom)
                    {
                        WRoom room = node as WRoom;
                        if (possibleRoomNums.Contains(room.RoomIndex))
                        {
                            containingRoom = room;
                        }
                    }
                }

                if (containingRoom == null)
                {
                    continue;
                }

                var containingRoomLight = containingRoom.EnvironmentLighting.Lerp(EnvironmentLightingConditions.WeatherPreset.Default, true, timeOfDay);
                child.ColorOverrides.SetTevColorOverride(0, containingRoomLight.ShadowColor);
                child.ColorOverrides.SetTevkColorOverride(0, containingRoomLight.ActorAmbientColor);
            }
        }