예제 #1
0
        void RemoveSquare(SquarePos pos)
        {
            ushort x1 = pos.X, x2 = (ushort)(pos.X + 1), y = 4, z1 = pos.Z, z2 = (ushort)(pos.Z + 1);

            Cuboid(x1, y, z1, x2, y, z2, Block.yellow, mapon);
            Thread.Sleep(speed);
            Cuboid(x1, y, z1, x2, y, z2, Block.orange, mapon);
            Thread.Sleep(speed);
            Cuboid(x1, y, z1, x2, y, z2, Block.red, mapon);
            Thread.Sleep(speed);
            Cuboid(x1, y, z1, x2, y, z2, Block.air, mapon);

            //beneath this is checking the glass next to the square
            bool up = false, left = false, right = false, down = false;

            //directly next to
            if (mapon.GetTile(x1, y, (ushort)(z2 + 2)) == Block.air) //right
            {
                mapon.Blockchange(x1, y, (ushort)(z2 + 1), Block.air);
                mapon.Blockchange(x2, y, (ushort)(z2 + 1), Block.air);
                right = true;
            }
            if (mapon.GetTile(x1, y, (ushort)(z1 - 2)) == Block.air) //left
            {
                mapon.Blockchange(x1, y, (ushort)(z1 - 1), Block.air);
                mapon.Blockchange(x2, y, (ushort)(z1 - 1), Block.air);
                left = true;
            }
            if (mapon.GetTile((ushort)(x2 + 2), y, z1) == Block.air) //up
            {
                mapon.Blockchange((ushort)(x2 + 1), y, z1, Block.air);
                mapon.Blockchange((ushort)(x2 + 1), y, z2, Block.air);
                up = true;
            }
            if (mapon.GetTile((ushort)(x1 - 2), y, z1) == Block.air) //down
            {
                mapon.Blockchange((ushort)(x1 - 1), y, z1, Block.air);
                mapon.Blockchange((ushort)(x1 - 1), y, z2, Block.air);
                down = true;
            }

            //diagonal >:(
            if ((mapon.GetTile((ushort)(x1 - 2), y, (ushort)(z1 - 2)) == Block.air) && left && down) //bottom left
            {
                mapon.Blockchange((ushort)(x1 - 1), y, (ushort)(z1 - 1), Block.air);
            }
            if ((mapon.GetTile((ushort)(x1 - 2), y, (ushort)(z2 + 2)) == Block.air) && right && down) //bottom right
            {
                mapon.Blockchange((ushort)(x1 - 1), y, (ushort)(z2 + 1), Block.air);
            }
            if ((mapon.GetTile((ushort)(x2 + 2), y, (ushort)(z1 - 2)) == Block.air) && left && up) //top left
            {
                mapon.Blockchange((ushort)(x2 + 1), y, (ushort)(z1 - 1), Block.air);
            }
            if ((mapon.GetTile((ushort)(x2 + 2), y, (ushort)(z2 + 2)) == Block.air) && right && up) //top right
            {
                mapon.Blockchange((ushort)(x2 + 1), y, (ushort)(z2 + 1), Block.air);
            }
        }
예제 #2
0
        void RemoveSquare(SquarePos pos)
        {
            ushort x1 = pos.X, x2 = (ushort)(pos.X + 1), y = 4, z1 = pos.Z, z2 = (ushort)(pos.Z + 1);

            Cuboid(x1, y, z1, x2, y, z2, Block.Yellow, Map);
            Thread.Sleep(Interval);
            Cuboid(x1, y, z1, x2, y, z2, Block.Orange, Map);
            Thread.Sleep(Interval);
            Cuboid(x1, y, z1, x2, y, z2, Block.Red, Map);
            Thread.Sleep(Interval);
            Cuboid(x1, y, z1, x2, y, z2, Block.Air, Map);
            // Remove glass borders if neighbouring squared were previously removed.

            bool airMaxX = false, airMinZ = false, airMaxZ = false, airMinX = false;

            if (Map.IsAirAt(x1, y, (ushort)(z2 + 2)))
            {
                Map.Blockchange(x1, y, (ushort)(z2 + 1), ExtBlock.Air);
                Map.Blockchange(x2, y, (ushort)(z2 + 1), ExtBlock.Air);
                airMaxZ = true;
            }
            if (Map.IsAirAt(x1, y, (ushort)(z1 - 2)))
            {
                Map.Blockchange(x1, y, (ushort)(z1 - 1), ExtBlock.Air);
                Map.Blockchange(x2, y, (ushort)(z1 - 1), ExtBlock.Air);
                airMinZ = true;
            }
            if (Map.IsAirAt((ushort)(x2 + 2), y, z1))
            {
                Map.Blockchange((ushort)(x2 + 1), y, z1, ExtBlock.Air);
                Map.Blockchange((ushort)(x2 + 1), y, z2, ExtBlock.Air);
                airMaxX = true;
            }
            if (Map.IsAirAt((ushort)(x1 - 2), y, z1))
            {
                Map.Blockchange((ushort)(x1 - 1), y, z1, ExtBlock.Air);
                Map.Blockchange((ushort)(x1 - 1), y, z2, ExtBlock.Air);
                airMinX = true;
            }

            // Remove glass borders for diagonals too.
            if (Map.IsAirAt((ushort)(x1 - 2), y, (ushort)(z1 - 2)) && airMinX && airMinZ)
            {
                Map.Blockchange((ushort)(x1 - 1), y, (ushort)(z1 - 1), ExtBlock.Air);
            }
            if (Map.IsAirAt((ushort)(x1 - 2), y, (ushort)(z2 + 2)) && airMinX && airMaxZ)
            {
                Map.Blockchange((ushort)(x1 - 1), y, (ushort)(z2 + 1), ExtBlock.Air);
            }
            if (Map.IsAirAt((ushort)(x2 + 2), y, (ushort)(z1 - 2)) && airMaxX && airMinZ)
            {
                Map.Blockchange((ushort)(x2 + 1), y, (ushort)(z1 - 1), ExtBlock.Air);
            }
            if (Map.IsAirAt((ushort)(x2 + 2), y, (ushort)(z2 + 2)) && airMaxX && airMaxZ)
            {
                Map.Blockchange((ushort)(x2 + 1), y, (ushort)(z2 + 1), ExtBlock.Air);
            }
        }
예제 #3
0
        void RemoveSquares()
        {
            Random rng = new Random();

            while (RoundInProgress && Running && squaresLeft.Count > 0 && Remaining.Count > 0)
            {
                int       i          = rng.Next(squaresLeft.Count);
                SquarePos nextSquare = squaresLeft[i];
                squaresLeft.RemoveAt(i);

                RemoveSquare(nextSquare);
                if (!Running || !RoundInProgress)
                {
                    return;
                }
                UpdateAllStatus1();
            }
        }
예제 #4
0
        void RemoveRandomSquares()
        {
            while (squaresLeft.Count > 0 && playersleftlist.Count != 0 &&
                   (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
            {
                Random    number     = new Random();
                int       index      = number.Next(squaresLeft.Count);
                SquarePos nextsquare = squaresLeft[index];
                squaresLeft.RemoveAt(index);
                RemoveSquare(nextsquare);

                if (squaresLeft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished)
                {
                    mapon.ChatLevel(squaresLeft.Count + " Squares Left and " + playersleftlist.Count + " Players left!!");
                }
                if (cancel)
                {
                    End(null);
                }
            }
        }
예제 #5
0
        void RemoveSquares()
        {
            Random rng = new Random();

            while (Status == CountdownGameStatus.RoundInProgress && squaresLeft.Count > 0 && Remaining.Count != 0)
            {
                int       i          = rng.Next(squaresLeft.Count);
                SquarePos nextSquare = squaresLeft[i];
                squaresLeft.RemoveAt(i);
                RemoveSquare(nextSquare);

                if (squaresLeft.Count % 10 == 0)
                {
                    if (Status != CountdownGameStatus.RoundInProgress)
                    {
                        return;
                    }
                    Map.ChatLevel(squaresLeft.Count + " squares left and " + Remaining.Count + " players remaining!");
                }
            }
        }
예제 #6
0
        void RemoveSquare(SquarePos pos)
        {
            ushort x1 = pos.X, x2 = (ushort)(pos.X + 1), z1 = pos.Z, z2 = (ushort)(pos.Z + 1);

            Cuboid(x1, 4, z1, x2, 4, z2, Block.Yellow);
            bulk.Flush();

            Thread.Sleep(Interval);
            Cuboid(x1, 4, z1, x2, 4, z2, Block.Orange);
            bulk.Flush();

            Thread.Sleep(Interval);
            Cuboid(x1, 4, z1, x2, 4, z2, Block.Red);
            bulk.Flush();

            Thread.Sleep(Interval);
            Cuboid(x1, 4, z1, x2, 4, z2, Block.Air);
            bulk.Flush();

            // Remove glass borders, if neighbouring squares were previously removed
            bool airMaxX = false, airMinZ = false, airMaxZ = false, airMinX = false;

            if (Map.IsAirAt(x1, 4, (ushort)(z2 + 2)))
            {
                Map.Blockchange(x1, 4, (ushort)(z2 + 1), Block.Air);
                Map.Blockchange(x2, 4, (ushort)(z2 + 1), Block.Air);
                airMaxZ = true;
            }
            if (Map.IsAirAt(x1, 4, (ushort)(z1 - 2)))
            {
                Map.Blockchange(x1, 4, (ushort)(z1 - 1), Block.Air);
                Map.Blockchange(x2, 4, (ushort)(z1 - 1), Block.Air);
                airMinZ = true;
            }
            if (Map.IsAirAt((ushort)(x2 + 2), 4, z1))
            {
                Map.Blockchange((ushort)(x2 + 1), 4, z1, Block.Air);
                Map.Blockchange((ushort)(x2 + 1), 4, z2, Block.Air);
                airMaxX = true;
            }
            if (Map.IsAirAt((ushort)(x1 - 2), 4, z1))
            {
                Map.Blockchange((ushort)(x1 - 1), 4, z1, Block.Air);
                Map.Blockchange((ushort)(x1 - 1), 4, z2, Block.Air);
                airMinX = true;
            }

            // Remove glass borders, if all neighbours to this corner have been removed
            if (Map.IsAirAt((ushort)(x1 - 2), 4, (ushort)(z1 - 2)) && airMinX && airMinZ)
            {
                Map.Blockchange((ushort)(x1 - 1), 4, (ushort)(z1 - 1), Block.Air);
            }
            if (Map.IsAirAt((ushort)(x1 - 2), 4, (ushort)(z2 + 2)) && airMinX && airMaxZ)
            {
                Map.Blockchange((ushort)(x1 - 1), 4, (ushort)(z2 + 1), Block.Air);
            }
            if (Map.IsAirAt((ushort)(x2 + 2), 4, (ushort)(z1 - 2)) && airMaxX && airMinZ)
            {
                Map.Blockchange((ushort)(x2 + 1), 4, (ushort)(z1 - 1), Block.Air);
            }
            if (Map.IsAirAt((ushort)(x2 + 2), 4, (ushort)(z2 + 2)) && airMaxX && airMaxZ)
            {
                Map.Blockchange((ushort)(x2 + 1), 4, (ushort)(z2 + 1), Block.Air);
            }
        }