示例#1
0
		//ncrunch: no coverage end

		private void InitGame()
		{
			Show();
			if (menu != null)
				menu.Hide();
			if (restartCommand != null && restartCommand.IsActive)
				restartCommand.Dispose(); //ncrunch: no coverage
			if (backToMenuCommand != null && backToMenuCommand.IsActive)
				backToMenuCommand.Dispose(); //ncrunch: no coverage
			if (gameOverMessage != null)
				gameOverMessage.Dispose(); //ncrunch: no coverage
			score = new Score();
			currentLevel = new Level(score);
			ball = new BallInLevel(new Paddle(), currentLevel);
			new UI(window, this);
			//ncrunch: no coverage start
			score.GameOver += () =>
			{
				RemoveOldObjects();
				gameOverMessage = new FontText(Font.Default, "That's it.\nGame Over!\n\nPress \"Q\" to " +
					"go back to the Main Menu.", Rectangle.One);
				restartCommand = new Command(InitGame).Add(new KeyTrigger(Key.Space)).
					Add(new MouseButtonTrigger()).Add(new TouchTapTrigger());
				backToMenuCommand = new Command(BackToMainMenu).Add(new KeyTrigger(Key.Q));
			};
			//ncrunch: no coverage end
			Score = score;
		}
示例#2
0
 public Level(Content content, Renderer renderer, Score score)
 {
     brickImage = content.Load<Image>("Brick");
     explosionImage = content.Load<Image>("Explosion");
     explosionSound = content.Load<Sound>("BrickExplosion");
     lostBallSound = content.Load<Sound>("LostBall");
     this.renderer = renderer;
     this.score = score;
     Initialize();
 }
示例#3
0
		public Level(Score score)
		{
			brickMaterial = new Material(ShaderFlags.Position2DColoredTextured, "Brick");
			var explosionMaterial = new Material(ShaderFlags.Position2DColoredTextured, "Explosion");
			explosionSound = ContentLoader.Load<Sound>("BrickExplosion");
			lostBallSound = ContentLoader.Load<Sound>("LostBall");
			explosionData = new ParticleEmitterData
			{
				Color = new RangeGraph<Color>(Color.White, Color.TransparentWhite),
				Size = new RangeGraph<Size>(ExplosionSize, ExplosionSize * 2),
				ParticleMaterial = explosionMaterial,
				MaximumNumberOfParticles = 1,
				LifeTime = 0.6f,
				SpawnInterval = -1
			};
			this.score = score;
			Initialize();
		}