예제 #1
0
        public override void Update(GameTime gameTime)
        {
            Random r         = ParticleManager.R;
            var    particles = new List <Particle>();

            fogElapsed += Stcs.DilateTime(gameTime.ElapsedGameTime);
            if (fogElapsed > fogTarget)
            {
                fogElapsed = TimeSpan.Zero;

                particles.Add(new Particle(new Rectangle(16, 0, 32, 32), new SnowModifier())
                {
                    Position = new Vector2(r.Next(Bounds.Width), -8),
                    Velocity = new Vector2(r.Next(4, 50), r.Next(120, 300)),
                    Scale    = 20f,
                    LifeSpan = TimeSpan.FromSeconds(4),
                    Tint     = Color.White * .2f
                });
            }

            rainElapsed += Stcs.DilateTime(gameTime.ElapsedGameTime);
            if (rainElapsed > rainTarget)
            {
                rainElapsed = TimeSpan.Zero;
                particles.Add(new Particle(new Rectangle(6, 0, 6, 16), new BasicModifier())
                {
                    Position = new Vector2(r.Next(Bounds.Width), -8),
                    Velocity = new Vector2(r.Next(20, 100), r.Next(500, 1500)),
                    Scale    = (float)r.NextDouble() / 4 + .5f,
                    LifeSpan = TimeSpan.FromSeconds(4),
                    Tint     = Color.Blue
                });
            }

            ParticleManager.AddParticles(particles);

            base.Update(gameTime);
        }
예제 #2
0
        public override void UpdateInput(InputManager input)
        {
            gui.UpdateInput(input);

            if (input.IsKeyPressed(Keys.H))
            {
                gui.BaseScreen.Hidden = !gui.BaseScreen.Hidden;
            }
            if (input.IsKeyPressed(Keys.V))
            {
                ScreenManager.VSync = !ScreenManager.VSync;
            }
            if (input.IsKeyPressed(Keys.M))
            {
                ScreenManager.MultiSampling = !ScreenManager.MultiSampling;
            }
            if (input.IsKeyPressed(Keys.Z))
            {
                Stcs.TC = 0;
            }
            if (input.IsKeyPressed(Keys.G))
            {
                pannell.Visuals = new DarkThemeVisuals(ScreenManager);
            }
            if (input.IsKeyPressed(Keys.F))
            {
                //labbell.Hidden = !labbell.Hidden;
                ScreenManager.Res        = ScreenManager.Res == new Point(1920, 1080) ? new Point(1280, 720) : new Point(1920, 1080);
                ScreenManager.FullScreen = !ScreenManager.FullScreen;
            }
            if (input.IsKeyPressed(Keys.Escape))
            {
                ExitScreen();
            }
            Stcs.TC += (.001f * input.MouseScrollDelta);
            if (input.IsKeyDown(Keys.P))
            {
                for (int i = 0; i < 10; i++)
                {
                    Vector2 v = new Vector2((float)r.NextDouble(), (float)r.NextDouble());
                    v.Normalize();

                    part.AddParticles(new List <Particle>()
                    {
                        new Particle()
                        {
                            SourceRec = new Rectangle(0, 0, 16, 16),
                            Velocity  = v,
                            Scale     = (float)r.NextDouble() / 2 + .25f,
                            Tint      = new Color(r.Next(5, 250), r.Next(5, 250), r.Next(5, 250)),
                            //Tint = new Color(0, 0, r.Next(100, 200)),
                            Modifiers = new List <ParticleModifier>()
                            {
                                new BasicModifier()
                            }
                        }
                    });
                }
            }

            if (input.IsKeyDown(Keys.W))
            {
                cam.DestPosition.Y -= 5;
            }
            if (input.IsKeyDown(Keys.A))
            {
                cam.DestPosition.X -= 5;
            }
            if (input.IsKeyDown(Keys.S))
            {
                cam.DestPosition.Y += 5;
            }
            if (input.IsKeyDown(Keys.D))
            {
                cam.DestPosition.X += 5;
            }

            verts[2].Position.X = input.MouseState.X - 640;
            verts[2].Position.Y = -input.MouseState.Y + 360;
            verts[5].Position.X = input.MouseState.X - 640;
            verts[5].Position.Y = -input.MouseState.Y + 360;

            base.UpdateInput(input);
        }