Esempio n. 1
0
        void UpdatePlaying()
        {
            if (GameStateMachine.Timer % 75 == 0)
            {
                float wallY = 0, secondWallY = 0;
                wallY       = Rand.Float(-430, -210);
                secondWallY = wallY + CurrentGap + 480;

                if (CurrentGap > 60)
                {
                    CurrentGap -= 5;
                }
                else
                {
                    CurrentGap -= 2;
                }

                CurrentGap = (int)Util.Clamp(CurrentGap, MinGap, MaxGap);

                Scene.Add(new Wall(700, wallY));
                Scene.Add(new Wall(700, secondWallY));
            }
            if (GameStateMachine.Timer % 60 == 0)
            {
                Score++;
            }

            EventRouter.Publish(Events.ScoreUpdated, Score, ScoreMultiplier);
        }
Esempio n. 2
0
 void EnterEnd()
 {
     FinalScore = Score * ScoreMultiplier;
     BestScore  = Util.Max(FinalScore, BestScore);
     EventRouter.Publish(Events.ShowFinalScore, FinalScore);
     EventRouter.Publish(Events.UpdateBestScore, BestScore, FinalScore);
     Tween(this, new { Score = 0 }, 30);
 }
Esempio n. 3
0
        void EnterPlaying()
        {
            CurrentGap      = 180;
            Score           = 0;
            ScoreMultiplier = 1;

            Scene.Add(new Flippy(Session));
            EventRouter.Publish(Events.GameStarted);
            EventRouter.Publish(Events.UpdateBestScore, BestScore, FinalScore);
        }
Esempio n. 4
0
        public override void Update()
        {
            base.Update();

            if (!Dead)
            {
                if (Session.Controller.A.Pressed)
                {
                    EventRouter.Publish(Events.FlippyFlipped);
                    Tween(Image, new { ScaleX = 1, ScaleY = 1 }, 45).From(new { ScaleX = 2f, ScaleY = 0.5f }).Ease(Ease.ElasticOut);
                    Tween(Image, new { Angle = 0 }, 30).From(new { Angle = Rand.Float(-10, 10) });
                    GravityDirection *= -1;
                    SpeedY           /= 4;
                }

                Scene.Add(new FlippyTrail(X, Y));
                Scene.Add(new FlippyTrail(X, Y + SpeedY * 0.005f));

                SpeedY += (int)(GravityDirection * GravityForce);
                SpeedY  = (int)Util.Clamp(SpeedY, -1000, 1000);

                Movement.MoveY(SpeedY);


                if (Overlap(X, Y, (int)Tags.Wall))
                {
                    Image.Color = Color.Red;
                    EventRouter.Publish(Events.FlippyDied);
                    Death();
                }
                if (Y < 50)
                {
                    EventRouter.Publish(Events.FlippyDied);
                    Death();
                }
                if (Y > Game.Instance.Height - 50)
                {
                    EventRouter.Publish(Events.FlippyDied);
                    Death();
                }
            }
            else
            {
                Image.Angle += 15;
            }
        }
Esempio n. 5
0
        public void Attach()
        {
            this.UpdateLayout();

            EventRouter.Publish <DependencyEvent, DependencyInfo>(new DependencyInfo(DependencyName.ControlTemplate, this));
        }
        protected override void OnInitialized(System.EventArgs e)
        {
            base.OnInitialized(e);

            EventRouter.Publish <DependencyEvent, DependencyInfo>(new DependencyInfo(DependencyName.LayoutInitialized));
        }
Esempio n. 7
0
 private void GoNextHandler(object obj)
 {
     EventRouter.Publish <PageChangeEvent, PageOption>(PageOption.Next);
 }
Esempio n. 8
0
 private void GoPreviousHandler(object obj)
 {
     EventRouter.Publish <PageChangeEvent, PageOption>(PageOption.Previous);
 }