Exemple #1
0
        private void HandleWall(Point currentPoint, Color wallColor, Color[] colorData, Level level)
        {
            Vertices vertices = new Vertices();

            // Add each adjacent pixel of the same color as a vertice and then white it
            do
            {
                vertices.Add(PointToPosition(currentPoint));
                colorData[ToArrayIndex(currentPoint.X, currentPoint.Y)] = Color.White;
            } while (GetAdjacent(currentPoint, wallColor, colorData, ref currentPoint));

            if (vertices.Count < 3)
            {
                return;
            }

            Wall.WallType wallType = Wall.WallType.Inner;

            if (wallColor.R % 2 == 0)
            {
                wallType = Wall.WallType.Outer;
            }

            level.AddWall(new Wall(vertices, wallType, PlayWindow));
        }
Exemple #2
0
        private void HandleWall(Point currentPoint, Color wallColor, Color[] colorData, Level level)
        {
            Vertices vertices = new Vertices();
            // Add each adjacent pixel of the same color as a vertice and then white it
            do
            {
                vertices.Add(PointToPosition(currentPoint));
                colorData[ToArrayIndex(currentPoint.X, currentPoint.Y)] = Color.White;
            } while (GetAdjacent(currentPoint, wallColor, colorData, ref currentPoint));

            if (vertices.Count < 3)
                return;

            Wall.WallType wallType = Wall.WallType.Inner;

            if (wallColor.R % 2 == 0)
                wallType = Wall.WallType.Outer;

            level.AddWall(new Wall(vertices, wallType, PlayWindow));
        }