void OnEnable()
 {
     sunlight           = (Sunlight)serializedObject.targetObject;
     sunlightParameters = serializedObject.FindProperty("sunlightParameters");
     drawGizmo          = serializedObject.FindProperty("drawGizmo");
     gizmoSize          = serializedObject.FindProperty("gizmoSize");
 }
Example #2
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Sky/Upper", true, out subEle);
            SkyUpper.WriteXML(subEle, master);

            ele.TryPathTo("Fog", true, out subEle);
            Fog.WriteXML(subEle, master);

            ele.TryPathTo("Unused1", true, out subEle);
            Unused1.WriteXML(subEle, master);

            ele.TryPathTo("Ambient", true, out subEle);
            Ambient.WriteXML(subEle, master);

            ele.TryPathTo("Sunlight", true, out subEle);
            Sunlight.WriteXML(subEle, master);

            ele.TryPathTo("Sun", true, out subEle);
            Sun.WriteXML(subEle, master);

            ele.TryPathTo("Stars", true, out subEle);
            Stars.WriteXML(subEle, master);

            ele.TryPathTo("Sky/Lower", true, out subEle);
            SkyLower.WriteXML(subEle, master);

            ele.TryPathTo("Horizon", true, out subEle);
            Horizon.WriteXML(subEle, master);

            ele.TryPathTo("Unused2", true, out subEle);
            Unused2.WriteXML(subEle, master);
        }
Example #3
0
    // Set the game time to the specified total second
    public void SetGameTime(float seconds)
    {
        dayTimeInGame = seconds;

        Sunlight sunScript = sun.GetComponent <Sunlight> ();

        sunScript.SetSunToTimeOfDay(GetDayTimeInHours());
    }
Example #4
0
 void OnEnable()
 {
     sunlight           = (Sunlight)serializedObject.targetObject;
     sunlightParameters = serializedObject.FindProperty("sunlightParameters");
     intensityCurve     = serializedObject.FindProperty("sunlightParameters.intensityCurve");
     gradient           = serializedObject.FindProperty("sunlightParameters.colorGradient");
     drawGizmo          = serializedObject.FindProperty("drawGizmo");
     gizmoSize          = serializedObject.FindProperty("gizmoSize");
 }
Example #5
0
        protected override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Sky/Upper", false, out subEle))
            {
                SkyUpper.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Fog", false, out subEle))
            {
                Fog.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Unused1", false, out subEle))
            {
                Unused1.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Ambient", false, out subEle))
            {
                Ambient.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Sunlight", false, out subEle))
            {
                Sunlight.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Sun", false, out subEle))
            {
                Sun.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Stars", false, out subEle))
            {
                Stars.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Sky/Lower", false, out subEle))
            {
                SkyLower.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Horizon", false, out subEle))
            {
                Horizon.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Unused2", false, out subEle))
            {
                Unused2.ReadXML(subEle, master);
            }
        }
Example #6
0
        private void SunlightButton_Clicked(object sender, EventArgs e)
        {
            Sunlight sunlight = new Sunlight()
            {
                CreatedAt = DateTime.Now,
                PlantId   = _viewModel.Id
            };

            using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
            {
                conn.CreateTable <Sunlight>();
                int rowsAdded = conn.Insert(sunlight);

                int addedXp     = 1000;
                int addedHealth = 15;

                if (_viewModel.Health >= 90)
                {
                    // Calculating the remainding health and adding to get the plant to 100% health
                    addedHealth = 100 - _viewModel.Health;
                }
                else if (_viewModel.Health <= 10)
                {
                    addedHealth = -_viewModel.Health;
                }

                var sunlightList = conn.Table <Sunlight>().ToList();
                var counter      = 0;
                foreach (var sun in sunlightList)
                {
                    DateTime previousDate = sun.CreatedAt;
                    if (sun.CreatedAt >= todaysDate && sun.CreatedAt <= previousDate.AddMinutes(5) && sun.PlantId == _viewModel.Id)
                    {
                        counter++;
                        if (counter > 4)
                        {
                            _viewModel.SunMessage = "Help! I'm burning";
                            addedHealth           = -10;
                        }
                    }
                }

                _viewModel.Id         = _viewModel.Id;
                _viewModel.PlantName  = _viewModel.PlantName;
                _viewModel.PlantColor = _viewModel.PlantColor;
                _viewModel.PlantType  = _viewModel.PlantType;
                _viewModel.Image      = _viewModel.Image;
                _viewModel.Health     = _viewModel.Health + addedHealth;
                _viewModel.Level      = GetLevelFromXp((_viewModel.Experience + addedXp));
                _viewModel.Experience = _viewModel.Experience + addedXp;

                conn.Update(_viewModel);
            }
        }
Example #7
0
 protected override void WriteData(ESPWriter writer)
 {
     SkyUpper.WriteBinary(writer);
     Fog.WriteBinary(writer);
     Unused1.WriteBinary(writer);
     Ambient.WriteBinary(writer);
     Sunlight.WriteBinary(writer);
     Sun.WriteBinary(writer);
     Stars.WriteBinary(writer);
     SkyLower.WriteBinary(writer);
     Horizon.WriteBinary(writer);
     Unused2.WriteBinary(writer);
 }
        static void DrawSunlightGizmo(Sunlight scr, GizmoType gizmoType)
        {
            var        childrentransforms = scr.GetComponentsInChildren <Transform>();
            GameObject sun       = null;
            GameObject yAxis     = null;
            GameObject lattitude = null;
            GameObject timeOfDay = null;

            for (int i = 0; i < childrentransforms.Length; i++)
            {
                if (childrentransforms[i].name == "DirectionalLight")
                {
                    sun = childrentransforms[i].gameObject;
                }
                if (childrentransforms[i].name == "SunlightYAxis")
                {
                    yAxis = childrentransforms[i].gameObject;
                }
                if (childrentransforms[i].name == "SunlightLattitude")
                {
                    lattitude = childrentransforms[i].gameObject;
                }
                if (childrentransforms[i].name == "SunlightTimeofdayDummy")
                {
                    timeOfDay = childrentransforms[i].gameObject;
                }
            }
            Gizmos.color = Handles.color = new Color(1, 1, 1, 0.3f);
            if (yAxis != null)
            {
                Handles.DrawWireDisc(yAxis.transform.position, yAxis.transform.up, scr.gizmoSize);
            }
            if (lattitude != null)
            {
                Handles.DrawWireArc(scr.gameObject.transform.position, lattitude.transform.right, lattitude.transform.forward, 180, scr.gizmoSize);
            }
            var gizmoColor = scr.sunlightParameters.lightParameters.colorFilter;

            Gizmos.color = Handles.color = gizmoColor;
            if (timeOfDay != null)
            {
                Gizmos.DrawLine(timeOfDay.transform.position, sun.transform.position);
            }
            Handles.DrawWireDisc(sun.transform.position, Camera.current.transform.forward, scr.gizmoSize / 10);
        }
Example #9
0
 protected override void ReadData(ESPReader reader)
 {
     using (MemoryStream stream = new MemoryStream(reader.ReadBytes(size)))
         using (ESPReader subReader = new ESPReader(stream, reader.Plugin))
         {
             try
             {
                 SkyUpper.ReadBinary(subReader);
                 Fog.ReadBinary(subReader);
                 Unused1.ReadBinary(subReader);
                 Ambient.ReadBinary(subReader);
                 Sunlight.ReadBinary(subReader);
                 Sun.ReadBinary(subReader);
                 Stars.ReadBinary(subReader);
                 SkyLower.ReadBinary(subReader);
                 Horizon.ReadBinary(subReader);
                 Unused2.ReadBinary(subReader);
             }
             catch
             {
                 return;
             }
         }
 }
Example #10
0
        public void Update(PerspectiveCamera camera, Seconds elapsed)
        {
            if (this.started == false)
            {
                return;
            }

            this.CutsceneSystem.Update(camera, elapsed);

            if (this.accumulator == 0)
            {
                this.ambientLight = this.SceneBuilder.BuildSponzaAmbientLight();
                this.sunlight     = this.SceneBuilder.BuildSponzaSunLight();
                this.PointLight   = this.SceneBuilder.BuildFirePlace();

                this.SceneBuilder.BuildStainedGlass();
                this.SceneBuilder.BuildBulletHoles();

                this.SceneBuilder.BuildCutScene();


                this.ambientLight.Color = Color.Black;
                this.sunlight.Move(this.sunlight.Position, new Vector3(-10.0f, this.sunlight.LookAt.Y, this.sunlight.LookAt.Z));

                this.ambientLight.Color = Color.Black;
                this.sunlight.Move(this.sunlight.Position, new Vector3(-10.0f, this.sunlight.LookAt.Y, this.sunlight.LookAt.Z));
                //MediaPlayer.Play(this.song);
            }

            if (this.accumulator < new Seconds(1))
            {
                this.PointLight.Color = Color.IndianRed * this.accumulator;
            }

            this.accumulator += elapsed;

            var warmup = new Seconds(7);

            if (this.accumulator > warmup)
            {
                var since = this.accumulator - warmup;

                var desiredOff2 = MathHelper.Clamp(since / 1, 0.0f, 9.25f);
                this.off2 = MathHelper.Lerp(this.off2, desiredOff2, 0.05f);
                this.sunlight.Move(this.sunlight.Position, new Vector3(-10.0f + this.off2, this.sunlight.LookAt.Y, this.sunlight.LookAt.Z));

                var off = MathHelper.Clamp(since / 23.0f, 0f, 0.4f);
                this.ambientLight.Color = new Color(off, off, off);
            }

            var secondState = new Seconds(26);

            if (this.accumulator > secondState)
            {
                if (this.shadowCastingLight == null)
                {
                    this.shadowCastingLight = this.SceneBuilder.BuildLionSpotLight();
                }

                var since = this.accumulator - secondState;
                var off   = MathHelper.Clamp(since / 2.0f, 0f, 0.8f);
                this.shadowCastingLight.Color = Color.White * off;
            }

            var fadeOut = new Seconds(28);

            if (this.accumulator > fadeOut)
            {
                var left = MathHelper.Clamp((this.accumulator - fadeOut) / 3.0f, 0, 1);
                MediaPlayer.Volume = 1.0f - left;
            }

            Debug.WriteLine(this.accumulator);
        }