예제 #1
0
파일: Grid.cs 프로젝트: whztt07/DeltaEngine
		private void AffixBrick(Brick brick)
		{
			brick.TopLeftGridCoord = new Vector2D((int)brick.TopLeftGridCoord.X,
				(int)brick.TopLeftGridCoord.Y + 1);
			bricks[(int)brick.Position.X, (int)brick.Position.Y - 1] = brick;
			brick.UpdateDrawArea();
			AddZoomingBrick(brick);
		}
예제 #2
0
		private void CreateBricks()
		{
			int numberOfBricks = content.AreFiveBrickBlocksAllowed
				? GetNumberOfBricks() : NormalNumberOfBricks;
			var material = new Material(ShaderFlags.Position2DColoredTextured,
				content.Prefix + "Block" + Randomizer.Current.Get(1, 8));
			var newBrick = new Brick(material, Vector2D.Zero, displayMode);
			Bricks = new List<Brick> { newBrick };
			for (int i = 1; i < numberOfBricks; i++)
				AddBrick(Bricks[i - 1], material);
			ShiftToTopLeft();
		}
예제 #3
0
		private void AddBrick(Brick lastBrick, Material material)
		{
			Brick newBrick;
			bool anyBrickAtNewOffset;
			do
			{
				newBrick = new Brick(material, lastBrick.Offset + GetRandomOffset(), displayMode)
				{
					IsActive = false
				};
				anyBrickAtNewOffset = false;
				foreach (Brick brick in Bricks)
					if (brick.Offset == newBrick.Offset)
					{
						anyBrickAtNewOffset = true;
						break;
					}
			} while (anyBrickAtNewOffset);
			Bricks.Add(newBrick);
			newBrick.IsActive = true;
		}
예제 #4
0
파일: Grid.cs 프로젝트: remy22/DeltaEngine
 private bool IsOccupied(Brick brick)
 {
     return bricks[(int)brick.Position.X, (int)brick.Position.Y] != null;
 }
예제 #5
0
파일: Grid.cs 프로젝트: remy22/DeltaEngine
 //ncrunch: no coverage start
 private void AddPairOfFallingBricks(Brick brick)
 {
     AddTopFallingBrick(brick);
     AddBottomFallingBrick(brick);
 }
예제 #6
0
파일: Grid.cs 프로젝트: remy22/DeltaEngine
 private static bool IsOutsideTheGrid(Brick brick)
 {
     return brick.Position.X < 0 || brick.Position.X >= Width || brick.Position.Y < 1 ||
         brick.Position.Y >= Height;
 }
예제 #7
0
파일: Block.cs 프로젝트: remy22/DeltaEngine
 private void CreateBricks()
 {
     int numberOfBricks = content.AreFiveBrickBlocksAllowed
         ? GetNumberOfBricks() : NormalNumberOfBricks;
     var image = content.Load<Image>("Block" + Randomizer.Current.Get(1, 8));
     var shader = ContentLoader.Load<Shader>(Shader.Position2DColorUV);
     var material = new Material(shader, image, image.PixelSize);
     var newBrick = new Brick(material, Vector2D.Zero, displayMode);
     Bricks = new List<Brick> { newBrick };
     for (int i = 1; i < numberOfBricks; i++)
         AddBrick(Bricks[i - 1], material);
     ShiftToTopLeft();
 }