Пример #1
0
        public bool Handle(IEvent evt)
        {
            PlayerLostEvent playerLostEvent = evt as PlayerLostEvent;

            if (playerLostEvent != null)
            {
                WaitProcess processChain    = new WaitProcess(Constants.Animations.GAME_OVER_WAIT);
                string      gameOverContent = playerLostEvent.WinPlayer.Name + Constants.Pong.GAME_OVER_CONTENT_SUFFIX;
                processChain.SetNext(new GameOverTextAnimation(_engine,
                                                               FontEntity.Create(_engine,
                                                                                 Vector2.Zero,
                                                                                 Content.Load <BitmapFont>(Constants.Resources.FONT_PONG_INTRO),
                                                                                 gameOverContent),
                                                               _mainCamera,
                                                               GameManager.GraphicsDevice))
                .SetNext(new WaitProcess(Constants.Animations.GAME_OVER_POST_WAIT))
                .SetNext(new DelegateCommand(() =>
                {
                    GameManager.ChangeState(new LobbyGameState(GameManager,
                                                               _player1.InputMethod,
                                                               (_player2 is AIPlayer) ? null : _player2.InputMethod));
                }));

                _processManager.Attach(processChain);

                return(false);
            }

            return(false);
        }
Пример #2
0
        void BeginIntroSequence()
        {
            WaitProcess             wait1 = new WaitProcess(Constants.Animations.INTRO_WAIT_DURATION);
            ReadyIntroTextAnimation readyIntroAnimation = new ReadyIntroTextAnimation(_engine,
                                                                                      FontEntity.Create(_engine,
                                                                                                        Vector2.Zero,
                                                                                                        Content.Load <BitmapFont>(Constants.Resources.FONT_PONG_INTRO),
                                                                                                        Constants.Pong.INTRO_READY_CONTENT),
                                                                                      _mainCamera,
                                                                                      GameManager.GraphicsDevice);

            wait1.SetNext(readyIntroAnimation);

            GoIntroTextAnimation goIntroAnimation = new GoIntroTextAnimation(_engine,
                                                                             FontEntity.Create(_engine,
                                                                                               Vector2.Zero,
                                                                                               Content.Load <BitmapFont>(Constants.Resources.FONT_PONG_INTRO),
                                                                                               Constants.Pong.INTRO_GO_CONTENT),
                                                                             _mainCamera,
                                                                             GameManager.GraphicsDevice);

            readyIntroAnimation.SetNext(goIntroAnimation);

            goIntroAnimation.SetNext(new DelegateCommand(() =>
            {
                EventManager.Instance.TriggerEvent(new StartEvent());
            }));

            _processManager.Attach(wait1);
        }