예제 #1
0
        /// <summary>
        /// Spawns the new static light.
        /// </summary>
        /// <param name="state">The state.</param>
        private void SpawnNewStaticLight(InputState state)
        {
            PointLight newLight = new PointLight(this.GameWorld)
            {
                Position              = new Vector3(this.RenderSystem.GetWorldFromScreen(new Vector2(state.CurrentMouseState.X, state.CurrentMouseState.Y)), 0.15f),
                Color                 = this.GetRandomColor(),
                Range                 = 8,
                Power                 = .5f,
                SpecularStrength      = 4.75f,
                CastsShadows          = true,
                MinShadowBlurDistance = .5f,
                MaxShadowBlurDistance = 2f
            };

            lightCount++;
            newLight.Body.BodyType            = FarseerPhysics.Dynamics.BodyType.Dynamic;
            newLight.Body.CollidesWith        = FarseerPhysics.Dynamics.Category.Cat1;
            newLight.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat2;
            newLight.Body.Friction            = 0;
            newLight.Body.Restitution         = 1.0f;

            if (this.IsDebug)
            {
                DebugSimulatedPostProcess z = new DebugSimulatedPostProcess(this.GameWorld, newLight);
            }

            this.RenderSystem.AddPostProcessEffect(newLight);
        }
예제 #2
0
        /// <summary>
        /// Spawns the new rotating light.
        /// </summary>
        /// <param name="state">The state.</param>
        private void SpawnNewRotatingLight(InputState state)
        {
            BouncyConeLight newLight = new BouncyConeLight(this.GameWorld)
            {
                Position              = new Vector3(this.RenderSystem.GetWorldFromScreen(new Vector2(state.CurrentMouseState.X, state.CurrentMouseState.Y)), 0.15f),
                Velocity              = this.GetRandomVelocity(),
                Color                 = this.GetRandomColor(),
                Power                 = 0.5f,
                Range                 = this.prng.Next(400, 600) / 100.0f,
                SpecularStrength      = 4.75f,
                AngularVelocity       = this.prng.Next(40, 90) / 100.0f,
                LightAngle            = MathHelper.PiOver2,
                MinShadowBlurDistance = .5f,
                MaxShadowBlurDistance = 2f,
                CastsShadows          = true
            };

            lightCount++;

            if (this.IsDebug)
            {
                var x = new DebugSimulatedPostProcess(this.GameWorld, newLight);
            }

            this.RenderSystem.AddPostProcessEffect(newLight);
        }
예제 #3
0
        /// <summary>
        /// Spawns the new small light.
        /// </summary>
        /// <param name="state">The state.</param>
        private void SpawnNewSmallLight(InputState state)
        {
            BouncyPointLight newLight = new BouncyPointLight(this.GameWorld)
            {
                Position              = new Vector3(this.RenderSystem.GetWorldFromScreen(new Vector2(state.CurrentMouseState.X, state.CurrentMouseState.Y)), 0.15f),
                Velocity              = this.GetRandomVelocity(),
                Color                 = this.GetRandomColor(),
                Power                 = 0.25f,
                Range                 = this.prng.Next(300, 500) / 100.0f,
                SpecularStrength      = 2.75f,
                MinShadowBlurDistance = .5f,
                MaxShadowBlurDistance = 2f,
                CastsShadows          = true
            };

            lightCount++;

            if (this.IsDebug)
            {
                DebugSimulatedPostProcess l = new DebugSimulatedPostProcess(this.GameWorld, newLight);
            }

            this.RenderSystem.AddPostProcessEffect(newLight);
        }
예제 #4
0
        /// <summary>
        /// Loads the content.
        /// </summary>
        protected override void LoadContent()
        {
            this.consoleFont = this.Content.Load <SpriteFont>("Content\\LucidaConsole");

            // Create Tiled Sprites
            RectangleF bounds = this.RenderSystem.GetCameraRenderBounds();

            this.background = new TiledSprite(this.GameWorld, "Content/floortile", "Content/floortilenormal", null, bounds.Position, Vector2.Zero, bounds.AreaBounds)
            {
                RenderScale   = new Vector2(0.4f, 0.4f),
                RenderOptions = SpriteRenderOptions.IsLit
            };

            SimpleSprite test = new SimpleSprite(this.GameWorld, "Content/box", null, false)
            {
                Position             = new Vector2(8, 7),
                RenderScale          = new Vector2(0.4f, 0.4f),
                RenderOptions        = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit,
                SpecularReflectivity = 0,
                LayerDepth           = 1
            };

            test.Body.BodyType            = FarseerPhysics.Dynamics.BodyType.Static;
            test.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1;
            test.Body.Friction            = 0;
            test.Body.Restitution         = 1.0f;

            if (this.IsDebug)
            {
                var x = new DebugSprite(this.GameWorld, test);
            }

            SimpleSprite test2 = new SimpleSprite(this.GameWorld, "Content/box", null, false)
            {
                Position             = new Vector2(10, 8),
                Rotation             = -MathHelper.PiOver2,
                RenderScale          = new Vector2(0.4f, 0.4f),
                RenderOptions        = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit,
                SpecularReflectivity = 0,
                LayerDepth           = 2
            };

            test2.Body.BodyType            = FarseerPhysics.Dynamics.BodyType.Static;
            test2.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1;
            test2.Body.Friction            = 0;
            test2.Body.Restitution         = 1.0f;

            if (this.IsDebug)
            {
                var x = new DebugSprite(this.GameWorld, test2);
            }

            SimpleSprite test3 = new SimpleSprite(this.GameWorld, "Content/gear", null, true)
            {
                Position             = new Vector2(20, 8),
                Rotation             = -MathHelper.PiOver2,
                RenderScale          = new Vector2(0.4f, 0.4f),
                RenderOptions        = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit,
                SpecularReflectivity = 0,
                LayerDepth           = 2
            };

            test3.Body.BodyType            = FarseerPhysics.Dynamics.BodyType.Static;
            test3.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1;
            test3.Body.Friction            = 0;
            test3.Body.Restitution         = 1.0f;

            if (this.IsDebug)
            {
                var x = new DebugSprite(this.GameWorld, test3);
            }

            this.amLight = new AmbientLight(Color.White, 0.02f, true, 1);
            this.RenderSystem.AddPostProcessEffect(this.amLight);

            mouseLight = new PointLight(this.GameWorld)
            {
                Color                 = Color.White,
                Power                 = 1f,
                Range                 = 8,
                SpecularStrength      = 4.75f,
                CastsShadows          = true,
                MinShadowBlurDistance = .5f,
                MaxShadowBlurDistance = 1.5f
            };
            lightCount++;

            if (this.IsDebug)
            {
                DebugSimulatedPostProcess y = new DebugSimulatedPostProcess(this.GameWorld, mouseLight);
            }

            this.RenderSystem.AddPostProcessEffect(mouseLight);

            // https://www.youtube.com/watch?v=BExTagcymo0
            // George Ellinas - Pulse (George Ellinas Remix) (Free - Creative Commons MP3)
            // http://creativecommons.org/licenses/by/3.0/
            this.song          = Content.Load <Song>("Content/George_Ellinas_-_Pulse_(George_Ellinas_remix)_LoopEdit");
            MediaPlayer.Volume = 0.1f;
            MediaPlayer.Play(song);


            base.LoadContent();
        }