Esempio n. 1
0
 public void CreateMap()
 {
     CurrectSelectorTween.Reset();
     CurrentFireWork = new RushFireWork(FireWorkArea.RandomPoint(), CreateColor(Splosion.Random.NextFloat()),
                                        Math.Max(.80f + (Splosion.Random.NextFloat() * .2f), 1f));
     Game.AddFireWorks(CurrentFireWork.Location, CurrentFireWork.Color, CurrentFireWork.Size);
 }
Esempio n. 2
0
        public void CreateMap()
        {
            //Determin number of fireworks 3-12 reach that at level 20+
            var numOfFW = Math.Max(Math.Min(Level, MaxFireworksLevelTopOut), MinFireworks);

            numOfFW = (numOfFW / MaxFireworksLevelTopOut) * MaxFireworks;
            numOfFW = Math.Max(numOfFW, MinFireworks);

            //Determin Time
            var time = (TimeSpan.TicksPerSecond * MinFWRelaseTime + (
                            (MaxFWRelaseTime - MinFWRelaseTime) * (1f - (Level / MinReleaseLevelTopOut))));
            var ttime = (time * numOfFW) + (TimeSpan.TicksPerSecond);
            var ctime = (float)TimeSpan.TicksPerSecond;

            //create first color
            var cv = Splosion.Random.NextFloat();

            var cd = Math.Max(Level, ColorDeviationTopOut) / ColorDeviationTopOut;

            //create first size;
            var s  = Math.Max(.80f + (Splosion.Random.NextFloat() * .2f), 1f);
            var sd = (Math.Max(Level, SizeDeviationTopOut) / SizeDeviationTopOut) * SizeMaxDeviation;

            var events = new List <FireWork>();

            for (var i = 0; i < (int)numOfFW; i++)
            {
                var loc = FireWorkArea.RandomPoint();

                var tme = ctime / ttime;
                s = Splosion.Random.NextFloat() > .5f ? Math.Max(s - (Splosion.Random.NextFloat() * sd), .33f) : Math.Min(s - (Splosion.Random.NextFloat() * sd), 1f);

                cv = Splosion.Random.NextFloat() > .5f ? Math.Max(cv + (Splosion.Random.NextFloat() * cd), 1f) : Math.Min(cv - (Splosion.Random.NextFloat() * cd), .2f);
                var c = CreateColor(cv);
                events.Add(new FireWork(loc, c, s, tme));
                ctime += time;
            }
            CurrentMap = new Map(Game, events, new TimeSpan((long)ttime));
        }
Esempio n. 3
0
        public override GameState <Splosion> Update(GameTime gameTime)
        {
            var pRect =
                new Rectangle((int)((Width - (Textures.TextPlay.Width * PlayTween.Value)) / 2), 300, (int)(Textures.TextPlay.Width * PlayTween.Value), (int)(Textures.TextPlay.Height * PlayTween.Value));

            var fpRect =
                new Rectangle((int)((Width - (Textures.TextFreePlay.Width * FreePlayTween.Value)) / 2), 372, (int)(Textures.TextFreePlay.Width * FreePlayTween.Value), (int)(Textures.TextFreePlay.Height * FreePlayTween.Value));

            var rRect =
                new Rectangle((int)((Width - (Textures.Continue.Width * ContinueTween.Value)) / 2), 444, (int)(Textures.Continue.Width * RushTween.Value), (int)(Textures.Continue.Height * ContinueTween.Value));


            var cRect =
                new Rectangle((int)((Width - (Textures.Continue.Width * ContinueTween.Value)) / 2), 516, (int)(Textures.Continue.Width * ContinueTween.Value), (int)(Textures.Continue.Height * ContinueTween.Value));



            if (!fpRect.Contains(new Point((int)Mouse.Location.X, (int)Mouse.Location.Y)))
            {
                FreePlayTween.Update(gameTime.ElapsedGameTime);
            }
            if (!pRect.Contains(new Point((int)Mouse.Location.X, (int)Mouse.Location.Y)))
            {
                PlayTween.Update(gameTime.ElapsedGameTime);
            }
            if (!rRect.Contains(new Point((int)Mouse.Location.X, (int)Mouse.Location.Y)))
            {
                RushTween.Update(gameTime.ElapsedGameTime);
            }
            if (!cRect.Contains(new Point((int)Mouse.Location.X, (int)Mouse.Location.Y)))
            {
                ContinueTween.Update(gameTime.ElapsedGameTime);
            }
            FadeTween.Update(gameTime.ElapsedGameTime);

            if (Choice)
            {
                if (FadeTween.IsComplete && FreePlay)
                {
                    return(new FreePlay(Game));
                }
                if (FadeTween.IsComplete && Rush)
                {
                    return(new Rush(Game));
                }
                if (FadeTween.IsComplete && Play)
                {
                    return(new Play(Game));
                }
                if (FadeTween.IsComplete && Continue)
                {
                    return(new Play(Game, Game.GameSettings.Data.GameScore, Game.GameSettings.Data.Level));
                }
            }
            else
            {
                NextExplosion -= gameTime.ElapsedGameTime;

                if (NextExplosion <= TimeSpan.Zero)
                {
                    NextExplosion = new TimeSpan(0, 0, 0, (int)(Splosion.Random.NextFloat() * 2),
                                                 50 + (int)(Splosion.Random.NextFloat() * 150));
                    var c = Color.Red;
                    c = Color.Lerp(c, Splosion.Random.NextFloat() > .5f ? Color.Green : Color.Blue, Splosion.Random.NextFloat());
                    Game.AddFireWorks(FireWorkArea.RandomPoint(), c, Splosion.Random.NextFloat());
                }
            }
            base.Update(gameTime);
            return(this);
        }