public void Update(GameTime time)
        {
            mouseOnBackButton = false;
            mouseOnBackButton =
                MouseHelper.X > 384 &&
                MouseHelper.Y > 544 &&
                MouseHelper.X < 640 &&
                MouseHelper.Y < 592;

            if (MouseHelper.LeftReleased)
            {
                if (mouseOnBackButton)
                {
                    game.ChangeScreen(game.MenuScreen);
                }
                else
                {
                    foreach (var link in links)
                    {
                        if (MouseHelper.X > link.Item1.Left &&
                            MouseHelper.Y > link.Item1.Top &&
                            MouseHelper.X < link.Item1.Right &&
                            MouseHelper.Y < link.Item1.Bottom
                            )
                        {
                            System.Diagnostics.Process.Start(link.Item2);
                        }
                    }
                }
            }

            var steps = (float)time.ElapsedGameTime.TotalMilliseconds / 100f * 6f;

            tinyFire.ForEach(p => p.Update(steps));
            tinyFire.RemoveAll(p => !p.IsAlive);

            if (mouseOnBackButton)
            {
                return;
            }

            var loc      = tinyFireLocations[Utils.Random.Next(tinyFireLocations.Length)];
            var tinyPart = new BigFlameParticle(menu.flameParts, 0.25f, 0.075f);

            tinyPart.Initialize(loc.X, loc.Y, Utils.Random);
            tinyFire.Add(tinyPart);
            tinyPart = new BigFlameParticle(menu.flameParts, 0.25f, 0.075f);
            tinyPart.Initialize(MouseHelper.X, MouseHelper.Y, Utils.Random);
            tinyFire.Add(tinyPart);
        }
Exemple #2
0
        public void Update(GameTime time)
        {
            timer += (float)time.ElapsedGameTime.TotalMilliseconds;
            var steps = (float)time.ElapsedGameTime.TotalMilliseconds / 100f * 6f;

            fire.ForEach(p => p.Update(steps));
            fire.RemoveAll(p => !p.IsAlive);
            while (timer > 1)
            {
                var part = new BigFlameParticle(flameParts);
                part.Initialize(Utils.Random.Next(1024), 640, Utils.Random);
                fire.Add(part);
                --timer;
            }

            tinyFire.ForEach(p => p.Update(steps));
            tinyFire.RemoveAll(p => !p.IsAlive);
            for (var i = 0; i < 3; ++i)
            {
                var index = Utils.Random.Next(tinyFireLocations.Length);
                if ((mouseOnStartButton && index < 4) ||
                    (mouseOnCreditsButton && index >= 4 && index < 8) ||
                    (mouseOnEndButton && index >= 8)
                    )
                {
                    continue;
                }
                var loc      = tinyFireLocations[index];
                var tinyPart = new BigFlameParticle(flameParts, 0.25f, 0.075f);
                tinyPart.Initialize(loc.X, loc.Y, Utils.Random);
                tinyFire.Add(tinyPart);
            }
            mouseOnStartButton = mouseOnCreditsButton = mouseOnEndButton = false;
            if (MouseHelper.X > 384 && MouseHelper.X < 640)
            {
                if (MouseHelper.Y > 200 && MouseHelper.Y < 248)
                {
                    mouseOnStartButton = true;
                }
                else if (MouseHelper.Y > 296 && MouseHelper.Y < 344)
                {
                    mouseOnCreditsButton = true;
                }
                else if (MouseHelper.Y > 392 && MouseHelper.Y < 440)
                {
                    mouseOnEndButton = true;
                }
            }

            if (MouseHelper.LeftReleased)
            {
                if (mouseOnStartButton)
                {
                    game.ChangeScreen(game.LevelSelectScreen);
                }
                else if (mouseOnCreditsButton)
                {
                    game.ChangeScreen(game.CreditsScreen);
                }
                else if (mouseOnEndButton)
                {
                    game.Exit();
                }
            }

            if (mouseOnStartButton || mouseOnCreditsButton || mouseOnEndButton)
            {
                return;
            }
            var _tinyPart = new BigFlameParticle(flameParts, 0.25f, 0.075f);

            _tinyPart.Initialize(MouseHelper.X, MouseHelper.Y, Utils.Random);
            tinyFire.Add(_tinyPart);
        }