public void Initialize()
        {
            mediaInitialized = false;

            Screen = new WriteableBitmap(Width, Height);
            TitleScreen = new TitleScreen(this);
            GameScreen = new GameScreen(this);
            InstructionScreen = new InstructionScreen(this);
            GameOverScreen = new GameOverScreen(this);

            ChangeToTitleScreen();
        }
Пример #2
0
        public void Initialize(BlackNectarGame game, GameScreen gameScreen)
        {
            this.game = game;
            this.gameScreen = gameScreen;

            Y = game.Height - 1 - PlayerHeight - PlayerMargin;
            X = (game.Width / 2.0f) - (PlayerWidth / 2.0f);
            XVelocity = 0;

            Energy = EnergyMax;
            EnergyBarHeight = game.Height - (2 * EnergyBarMargin) - PlayerHeight - PlayerMargin;
            EnergyBarLeft = game.Width - 1 - EnergyBarWidth - EnergyBarMargin;
            EnergyBarRight = EnergyBarLeft + EnergyBarWidth;
            EnergyBarBottom = game.Height - 1 - PlayerMargin - PlayerHeight - EnergyBarMargin;

            barBlink = false;
            barBlinkTimer = new PeriodicTimer();
            barBlinkTimer.Period = 0.4f;
            barBlinkTimer.OnChange += () =>
                {
                    barBlink = !barBlink;
                };
        }