示例#1
0
        private void AddFireWorks(Vector2 point, Color color, float size)
        {
            Game.AddFireWorks(point, color, size);

            var f  = new RushFireWork(point, color, size);
            var s  = f.Compare(CurrentFireWork);
            var ms = MiniScore.GetMiniScoreFor(s);
            int sc = MiniScore.GetScoreFor(ms);

            ScoreParticles.Add(new MiniScore
            {
                Score    = ms,
                Location = point,
                Fade     = new Tween(new TimeSpan(0, 0, 0, 1), 1, 0)
            });
            if (sc == MiniScore.GetScoreFor(MiniScores.PERFECT))
            {
                Multiplier++;
                if (Multiplier > 3)
                {
                    Multiplier = 3;
                }
                MultiplierTween.Reset();
            }
            Score += sc * (Multiplier + 1);

            var pTime = new TimeSpan(MiniScore.GetTimeFor(MiniScore.GetMiniScoreFor(s)).Ticks *(Multiplier + 1));

            if (pTime > TimeSpan.Zero)
            {
                TimeParticles.Add(new TimeParticle
                {
                    Time     = float.Parse(pTime.Seconds + ((pTime.Milliseconds > 0)?"." + pTime.Milliseconds:"")),
                    Location = point,
                    Fade     = new Tween(new TimeSpan(0, 0, 0, 6), 1, 0)
                });
            }
            TTL += pTime;
            if (TTL > CurrentTTL)
            {
                if (TTL > MaxTTL)
                {
                    TTL        = MaxTTL;
                    CurrentTTL = TTL;
                }
                else
                {
                    CurrentTTL = TTL;
                }
            }
            RSG = PlayState.ADD;
        }
示例#2
0
        private void AddFireWorks(Vector2 point, Color color, float size)
        {
            if (CurrentMap.Events.Count <= RecordEvents.Count)
            {
                return;
            }
            Game.AddFireWorks(point, color, size);
            var f = new FireWork(point, color, size, CurrentMap.Complete);
            var s = f.Compare(CurrentMap.Events[RecordEvents.Count]);

            ScoreParticles.Add(new MiniScore
            {
                Score    = MiniScore.GetMiniScoreFor(s),
                Location = point,
                Fade     = new Tween(new TimeSpan(0, 0, 0, 1), 1, 0)
            });

            RecordEvents.Add(f);

            Score += MiniScore.GetScoreFor(MiniScore.GetMiniScoreFor(s));
        }
示例#3
0
        public void DrawScore()
        {
            var v = new Vector2(10, 10);

            SpriteBatch.Draw(Textures.BestScore, v, Color.White * .6f * FadeTween);
            v = new Vector2(v.X, v.Y + Textures.BestScore.Height);
            Utilities.DrawNumbers(SpriteBatch, Game.BestScore, v, Color.White * .6f * FadeTween);
            v = new Vector2(v.X, v.Y + 42);
            SpriteBatch.Draw(Textures.Score, v, Color.White * .6f * FadeTween);
            v = new Vector2(v.X, v.Y + Textures.Score.Height);
            Utilities.DrawNumbers(SpriteBatch, Score, v, Color.White * .6f * FadeTween);
            v = new Vector2(v.X, v.Y + 42);
            SpriteBatch.Draw(Textures.Required, v, Color.White * .6f * FadeTween);
            v = new Vector2(v.X, v.Y + Textures.Required.Height);
            var numOfFW = Math.Max(Math.Min(Level, MaxFireworksLevelTopOut), MinFireworks);

            numOfFW = (numOfFW / MaxFireworksLevelTopOut) * MaxFireworks;
            numOfFW = Math.Max(numOfFW, MinFireworks);
            var rscore = (int)((numOfFW * MiniScore.GetScoreFor(MiniScores.GOOD)));

            Utilities.DrawNumbers(SpriteBatch, rscore, v, Color.White * .6f * FadeTween);
            v = new Vector2(Width - Textures.HighScore.Width, 10);
            SpriteBatch.Draw(Textures.HighScore, v, Color.White * .6f * FadeTween);
            var w = Utilities.GetNumWidth(Game.HighScore);

            v = new Vector2(Width - w, v.Y + Textures.HighScore.Height);
            Utilities.DrawNumbers(SpriteBatch, Game.HighScore, v, Color.White * .6f * FadeTween);

            v = new Vector2(Width - Textures.Score.Width, v.Y + 42);
            SpriteBatch.Draw(Textures.Score, v, Color.White * .6f * FadeTween);
            w = Utilities.GetNumWidth(GameScore);
            v = new Vector2(Width - w, v.Y + Textures.Score.Height);
            Utilities.DrawNumbers(SpriteBatch, GameScore, v, Color.White * .6f * FadeTween);

            v = new Vector2(Width - Textures.Level.Width, v.Y + 42);
            SpriteBatch.Draw(Textures.Level, v, Color.White * .6f * FadeTween);
            w = Utilities.GetNumWidth(Level);
            v = new Vector2(Width - w, v.Y + Textures.Level.Height);
            Utilities.DrawNumbers(SpriteBatch, Level, v, Color.White * .6f * FadeTween);
        }
示例#4
0
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch.Begin();
            switch (RSG)
            {
            case PlayState.KEEP_UP:
                SpriteBatch.Draw(Textures.TextKeepUp,
                                 new Vector2(Center.X - Textures.TextKeepUp.Center().X, Center.Y - Textures.TextKeepUp.Center().Y),
                                 Color.White * (float)Math.Sin(ActionTween * Math.PI));
                break;

            case PlayState.READY:
                SpriteBatch.Draw(Textures.TextReady,
                                 new Vector2(Center.X - Textures.TextReady.Center().X, Center.Y - Textures.TextReady.Center().Y),
                                 Color.White * (float)Math.Sin(ActionTween * Math.PI));
                break;

            case PlayState.SET:
                SpriteBatch.Draw(Textures.TextSet,
                                 new Vector2(Center.X - Textures.TextSet.Center().X, Center.Y - Textures.TextSet.Center().Y),
                                 Color.White * (float)Math.Sin(ActionTween * Math.PI));
                break;

            case PlayState.GO:
                SpriteBatch.Draw(Textures.TextGo,
                                 new Vector2(Center.X - Textures.TextGo.Center().X, Center.Y - Textures.TextGo.Center().Y),
                                 Color.White * (float)Math.Sin(ActionTween * Math.PI));
                break;

            case PlayState.PLAY:

                break;
            }



            DrawProgress();

            if (Multiplier == 0)
            {
                SpriteBatch.Draw(Textures.X1, new Vector2(10, (int)Height - 83), Color.White * MultiplierTween);
            }
            if (Multiplier == 1)
            {
                SpriteBatch.Draw(Textures.X2, new Vector2(10, (int)Height - 83), Color.White * MultiplierTween);
            }
            if (Multiplier == 2)
            {
                SpriteBatch.Draw(Textures.X3, new Vector2(10, (int)Height - 83), Color.White * MultiplierTween);
            }
            if (Multiplier == 3)
            {
                SpriteBatch.Draw(Textures.X4, new Vector2(10, (int)Height - 83), Color.White * MultiplierTween);
            }
            if (CurrentFireWork != null)
            {
                SpriteBatch.Draw(Textures.Selector, CurrentFireWork.Location - Textures.Selector.Center(), null, CurrentFireWork.Color * CurrectSelectorTween, 0, Vector2.Zero, CurrentFireWork.Size, SpriteEffects.None, 1);
            }


            foreach (var s in ScoreParticles)
            {
                var t = MiniScore.GetTextureFor(s.Score);
                SpriteBatch.Draw(t, new Vector2(s.Location.X - (t.Width / 2f), s.Location.Y), Color.White * s.Fade);
            }

            foreach (var s in TimeParticles)
            {
                Utilities.DrawNumbersPlus(SpriteBatch, s.Time, s.Location, Color.White * s.Fade);
                //var t = MiniScore.GetTextureFor(s.Score);
                //SpriteBatch.Draw(t, new Vector2(s.Location.X - (t.Width / 2f), s.Location.Y), Color.White * s.Fade);
            }
            DrawScore();

            SpriteBatch.End();
            base.Draw(gameTime);
        }
示例#5
0
        public override void Draw(GameTime gameTime)
        {
//Draw Menu and Interfave
            SpriteBatch.Begin();
            SpriteBatch.Draw(Textures.Hand, new Vector2(HandMoveH - 52, HandMoveV - Textures.Hand.Height),
                             Color.White * HandFade);
            switch (RSG)
            {
            case PlayState.HAND_DOWN:
            case PlayState.HAND_UP:
            case PlayState.HAND_LEFT:
            case PlayState.HAND_RIGHT:
            case PlayState.HIDE_HAND:
            case PlayState.SHOW_HAND:
                if (HandFade.IsComplete)
                {
                    Selector.DrawSelector(SpriteBatch, new Vector2(Center.X - 52, Center.Y - Textures.Hand.Height),
                                          new Vector2(HandMoveH, HandMoveV - Textures.Hand.Height));
                }
                break;

            case PlayState.WATCH:
                SpriteBatch.Draw(Textures.TextWatch,
                                 new Vector2(Center.X - Textures.TextWatch.Center().X, Center.Y - Textures.TextWatch.Center().Y),
                                 Color.White * (float)Math.Sin(ActionTween * Math.PI));
                break;

            case PlayState.READY:
                SpriteBatch.Draw(Textures.TextReady,
                                 new Vector2(Center.X - Textures.TextReady.Center().X, Center.Y - Textures.TextReady.Center().Y),
                                 Color.White * (float)Math.Sin(ActionTween * Math.PI));
                break;

            case PlayState.SET:
                SpriteBatch.Draw(Textures.TextSet,
                                 new Vector2(Center.X - Textures.TextSet.Center().X, Center.Y - Textures.TextSet.Center().Y),
                                 Color.White * (float)Math.Sin(ActionTween * Math.PI));
                break;

            case PlayState.GO:
                SpriteBatch.Draw(Textures.TextGo,
                                 new Vector2(Center.X - Textures.TextGo.Center().X, Center.Y - Textures.TextGo.Center().Y),
                                 Color.White * (float)Math.Sin(ActionTween * Math.PI));
                break;

            case PlayState.PLAY:
                break;
            }

            SpriteBatch.Draw(Textures.Saved,
                             new Vector2(Center.X - Textures.Saved.Center().X, Center.Y - Textures.Saved.Center().Y),
                             Color.White * (float)Math.Sin(SavedTween * Math.PI));
            DrawProgress();
            foreach (var s in ScoreParticles)
            {
                var t = MiniScore.GetTextureFor(s.Score);
                SpriteBatch.Draw(t, new Vector2(s.Location.X - (t.Width / 2f), s.Location.Y), Color.White * s.Fade);
            }
            ScoreParticles.RemoveAll(p => p.Fade.IsComplete);
            DrawScore();

            SpriteBatch.Draw(Textures.Save,
                             new Vector2(0, (Game.GraphicsDevice.Viewport.Height - ((Textures.Save.Height * SaveTween.Value) + 30))), null, Color.White * SaveFadeTween.Value * FadeTween.Value, 0f, Vector2.Zero, SaveTween.Value, SpriteEffects.None, 1f);

            //  var rect =
            //     new Rectangle(0, (int)(Game.GraphicsDevice.Viewport.Height - ((Textures.Save.Height * SaveTween.Value))) - 30, (int)(Textures.Save.Width * SaveTween.Value), (int)(Textures.Save.Height * SaveTween.Value));
            //  Utilities.DrawRectangle(SpriteBatch, rect);
            //SpriteBatch.DrawString(Fonts.ArialSmall, Score + " Score" + ScoreParticles.Count + " Record" + RecordEvents.Count + "  Map " + CurrentMap.Events.Count, new Vector2(10, 10), Color.White);
            SpriteBatch.End();
            base.Draw(gameTime);
        }
示例#6
0
        public Play(Splosion game, int gameScore = 0, int level = 0)
            : base(game)
        {
            GameScore      = gameScore;
            Level          = level;
            ScoreParticles = new List <MiniScore>();
            RecordEvents   = new List <FireWork>();
            HandFade       = new Tween(new TimeSpan(0, 0, 0, 1), 0, 0);
            HandMoveH      = new Tween(new TimeSpan(0, 0, 0, 1), Game.Center.X, Game.Center.X);
            HandMoveV      = new Tween(new TimeSpan(0, 0, 0, 1), Game.Center.Y, Game.Center.Y);
            SelectorFader  = new Tween(new TimeSpan(0, 0, 0, 3), 1, 0);
            SaveFadeTween  = new Tween(new TimeSpan(0, 0, 0, 1), 0, 1);
            SaveTween      = new Tween(new TimeSpan(0, 0, 0, 2), 1f, 1.1f, true);
            SavedTween     = new Tween(new TimeSpan(0, 0, 0, 1), 0, 1);
            SavedTween.Finish();

            Mouse.LeftClickListeners.Add(CheckSave);
            // Touch.MoveListeners.Add(CheckSave);
            Touch.TapListeners.Add(CheckSave);

            CreateMap();
            if (Game.ShownHint)
            {
                RSG = PlayState.WATCH;
            }
            else
            {
                Game.ShownHint = true;
                RSG            = PlayState.SHOW_HAND;
            }
            ActionTween = new Tween(new TimeSpan(0, 0, 0, 1), 0, 1);
            ActionTween.AddEventListener(.5f, t =>
            {
                switch (RSG)
                {
                case PlayState.WATCH:
                    Game.Audio.Play(Sounds.Menu);
                    break;

                case PlayState.READY:
                    Game.Audio.Play(Sounds.Menu);
                    break;

                case PlayState.SET:
                    Game.Audio.Play(Sounds.Menu);
                    break;

                case PlayState.GO:
                    Game.Audio.Play(Sounds.Menu);
                    break;
                }
            });
            ActionTween.CompletionListeners.Add(t =>
            {
                switch (RSG)
                {
                case PlayState.SHOW_HAND:
                    Selector.ShowRadius = false;
                    Selector.SelectorListeners.Clear();
                    HandFade = new Tween(new TimeSpan(0, 0, 0, 1), 0, 1);
                    RSG      = PlayState.HAND_RIGHT;
                    ActionTween.Reset();
                    break;

                case PlayState.HAND_RIGHT:
                    Selector.ShowRadius = false;
                    HandMoveH           = new Tween(new TimeSpan(0, 0, 0, 1), Game.Center.X, Game.Center.X + 100);
                    RSG = PlayState.HAND_LEFT;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 1));
                    break;

                case PlayState.HAND_LEFT:
                    Selector.ShowRadius = false;
                    HandMoveH           = new Tween(new TimeSpan(0, 0, 0, 2), Game.Center.X + 100, Game.Center.X - 200);
                    RSG = PlayState.HAND_UP;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 2));
                    break;

                case PlayState.HAND_UP:
                    Selector.ShowRadius = false;
                    HandMoveV           = new Tween(new TimeSpan(0, 0, 0, 1), Game.Center.Y, Game.Center.Y + 100);
                    RSG = PlayState.HAND_DOWN;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 1));
                    break;

                case PlayState.HAND_DOWN:
                    Selector.ShowRadius = false;
                    HandMoveV           = new Tween(new TimeSpan(0, 0, 0, 2), Game.Center.Y + 100, Game.Center.Y - 200);
                    RSG = PlayState.HIDE_HAND;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 2));
                    break;

                case PlayState.HIDE_HAND:
                    Selector.ShowRadius = false;
                    Game.AddFireWorks(new Vector2(Center.X - 52, Center.Y - Textures.Hand.Height), Color.Blue, 1);
                    HandFade = new Tween(new TimeSpan(0, 0, 0, 1), 1, 0);
                    RSG      = PlayState.WATCH;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 1));
                    break;

                case PlayState.WATCH:
                    Score = 0;
                    Selector.ShowRadius = false;
                    Selector.SelectorListeners.Clear();
                    RSG = PlayState.WAIT1;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 2));
                    break;

                case PlayState.WAIT1:
                    Selector.ShowRadius = false;
                    RSG = PlayState.VIEW;
                    CurrentMap.AddEvents();
                    SelectorFader.Reset();
                    ActionTween.Reset(CurrentMap.Timer);
                    break;

                case PlayState.VIEW:
                    Selector.ShowRadius = false;
                    RSG = PlayState.READY;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 1));
                    break;

                case PlayState.READY:
                    Selector.ShowRadius = false;
                    RSG = PlayState.SET;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 1));
                    break;

                case PlayState.SET:
                    Selector.ShowRadius = false;
                    CurrentMap.RemoveEvents();
                    RSG = PlayState.GO;
                    ActionTween.Reset();
                    break;

                case PlayState.GO:
                    RSG = PlayState.PLAY;
                    Selector.ShowRadius = true;
                    Selector.SelectorListeners.Add(AddFireWorks);
                    ActionTween.Reset(CurrentMap.Timer);
                    CurrentMap.MapTween.Reset();
                    RecordEvents.Clear();
                    ScoreParticles.Clear();
                    break;

                case PlayState.PLAY:
                    Selector.ShowRadius = false;
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 3));
                    RSG = PlayState.REVIEW;
                    break;

                case PlayState.REVIEW:
                    Selector.ShowRadius = false;
                    var numOfFW         = Math.Max(Math.Min(Level, MaxFireworksLevelTopOut), MinFireworks);
                    numOfFW             = (numOfFW / MaxFireworksLevelTopOut) * MaxFireworks;
                    numOfFW             = Math.Max(numOfFW, MinFireworks);
                    var rscore          = (int)((numOfFW * MiniScore.GetScoreFor(MiniScores.GOOD)));
                    if (Score >= rscore)
                    {
                        GameScore += Score;
                        Level++;
                    }
                    if (Score > Game.BestScore)
                    {
                        Game.BestScore = Score;
                    }
                    if (GameScore > Game.HighScore)
                    {
                        Game.HighScore = GameScore;
                    }
                    CreateMap();
                    ActionTween.Reset(new TimeSpan(0, 0, 0, 1));
                    RSG = PlayState.WATCH;
                    break;
                }
            });
        }