public GameScreen(BlackNectarGame game)
 {
     this.game = game;
     starField = new StarField();
     starField.Initialize(game, StarField.StarCount);
     fadeRect = new Rectangle();
     fadeRect.Fill = new SolidColorBrush(Colors.Black);
     fadeRect.Width = game.Width;
     fadeRect.Height = game.Height;
     fadeRect.Opacity = 0.0f;
     fadeTransform = new TranslateTransform();
     fadeTransform.X = 0;
     fadeTransform.Y = 0;
 }
 public GameScreen(BlackNectarGame game)
 {
     this.game = game;
     starField = new StarField();
     starField.Initialize(game, StarField.StarCount);
     fadeRect         = new Rectangle();
     fadeRect.Fill    = new SolidColorBrush(Colors.Black);
     fadeRect.Width   = game.Width;
     fadeRect.Height  = game.Height;
     fadeRect.Opacity = 0.0f;
     fadeTransform    = new TranslateTransform();
     fadeTransform.X  = 0;
     fadeTransform.Y  = 0;
 }
 public GameOverScreen(BlackNectarGame game)
 {
     this.game            = game;
     blinkTimer           = new PeriodicTimer();
     blinkTimer.OnChange += () =>
     {
         // Every second blink for a half second
         blink = !blink;
         if (!blink)
         {
             blinkTimer.Period = BlinkOnPeriod;
         }
         else
         {
             blinkTimer.Period = BlinkOffPeriod;
         }
     };
 }
 public GameOverScreen(BlackNectarGame game)
 {
     this.game = game;
     blinkTimer = new PeriodicTimer();
     blinkTimer.OnChange += () =>
     {
         // Every second blink for a half second
         blink = !blink;
         if (!blink)
         {
             blinkTimer.Period = BlinkOnPeriod;
         }
         else
         {
             blinkTimer.Period = BlinkOffPeriod;
         }
     };
 }
Exemple #5
0
 public TitleScreen(BlackNectarGame game)
 {
     this.game = game;
     starField = new StarField();
     starField.Initialize(game, StarField.StarCount);
     blinkTimer           = new PeriodicTimer();
     blinkTimer.OnChange += () =>
     {
         // Every second blink for a half second
         blink = !blink;
         if (!blink)
         {
             blinkTimer.Period = BlinkOnPeriod;
         }
         else
         {
             blinkTimer.Period = BlinkOffPeriod;
         }
     };
 }
 public TitleScreen(BlackNectarGame game)
 {
     this.game = game;
     starField = new StarField();
     starField.Initialize(game, StarField.StarCount);
     blinkTimer = new PeriodicTimer();
     blinkTimer.OnChange += () =>
         {
             // Every second blink for a half second
             blink = !blink;
             if (!blink)
             {
                 blinkTimer.Period = BlinkOnPeriod;
             }
             else
             {
                 blinkTimer.Period = BlinkOffPeriod;
             }
         };
 }
Exemple #7
0
 public InstructionScreen(BlackNectarGame game)
 {
     this.game            = game;
     blinkTimer           = new PeriodicTimer();
     blinkTimer.OnChange += () =>
     {
         // Every second blink for a half second
         blink = !blink;
         if (!blink)
         {
             blinkTimer.Period = BlinkOnPeriod;
         }
         else
         {
             blinkTimer.Period = BlinkOffPeriod;
         }
     };
     energyTimer           = new PeriodicTimer();
     energyTimer.OnChange += () =>
     {
         energyColor = energyColor == Palette.Energy1 ? Palette.Energy2 : Palette.Energy1;
     };
 }
 public InstructionScreen(BlackNectarGame game)
 {
     this.game = game;
     blinkTimer = new PeriodicTimer();
     blinkTimer.OnChange += () =>
     {
         // Every second blink for a half second
         blink = !blink;
         if (!blink)
         {
             blinkTimer.Period = BlinkOnPeriod;
         }
         else
         {
             blinkTimer.Period = BlinkOffPeriod;
         }
     };
     energyTimer = new PeriodicTimer();
     energyTimer.OnChange += () =>
         {
             energyColor = energyColor == Palette.Energy1 ? Palette.Energy2 : Palette.Energy1;
         };
 }
        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;
            };
        }
Exemple #10
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;
                };
        }