public GameEngine()
        {
            this.graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth = screenWidth,
                PreferredBackBufferHeight = screenHeight
            };

            this.screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

            Content.RootDirectory = "Content";

            this.Components.Add(new TextureLoader(this));

            this.Components.Add(new InputHandler(this));

            this.stateManager = new GameStateManager(this);
            this.Components.Add(this.stateManager);

            this.titleScreen = new TitleScreen(this, this.stateManager);
            this.stateManager.ChangeState(this.titleScreen);

            this.playingScreen = new PlayingScreen(this, this.stateManager);
            this.stateManager.ChangeState(this.playingScreen);
        }
예제 #2
0
        private void RegisterGameScreens()
        {
            var _titleScreen    = new TitleScreen(this);
            var _playingScreen  = new PlayingScreen(this);
            var _gameOverScreen = new GameOverScreen(this);

            _titleScreen.StartNewGame             += StartNewGame;
            _playingScreen.GameOver               += GameOver;
            _gameOverScreen.GameOverDelayComplete += GameOverDelayComplete;

            _gameScreens[GameState.TitleScreen]   = _titleScreen;
            _gameScreens[GameState.PlayingScreen] = _playingScreen;
            _gameScreens[GameState.GameOver]      = _gameOverScreen;
        }
예제 #3
0
        private void RegisterGameScreens()
        {
            TitleScreen ts = new TitleScreen(this);

            ts.StartGame += (s, e) => _gameScreenState.SetState(GameState.Playing);

            PlayingScreen ps = new PlayingScreen(this);

            ps.GameOverWaitFinished += (s, e) => _gameScreenState.SetState(GameState.TitleScreen);

            GameScreenMap <GameState> map = new GameScreenMap <GameState>()
                                            .AddState(GameState.TitleScreen, ts)
                                            .AddState(GameState.Playing, ps);

            _gameScreenState = new GameScreenState <GameState>(map, GameState.TitleScreen);
        }
예제 #4
0
        // SpriteManager spriteManaer;
        public Lion(Texture2D image, int timeSinceLastFrame, Point currentFrame, Vector2 position, float velocity,
                    int attack, int defend, int vision, int type, bool isMine,
                    float blood, float rateImage, bool live, int level, PlayingScreen spriteManager, Texture2D imagiBlood)
            : base(image, currentFrame, timeSinceLastFrame, position, velocity, attack, defend, vision, type, isMine, blood, rateImage, live, level, spriteManager, imagiBlood)
        {
            compatibility = new List <Rectangle> {
                new Rectangle(292, 39, 211, 139),
                new Rectangle(656, 35, 144, 209),
                new Rectangle(467, 320, 90, 100),
                new Rectangle(0, 0, 100, 100)
            };

            unCompatibility = new List <Rectangle> {
                new Rectangle(371, 482, 113, 118),
                new Rectangle(688, 412, 112, 188),
            };
        }