Beispiel #1
0
        private static List <DXBox> Level2()
        {
            List <DXBox> ret  = new List <DXBox>();
            BoxKind      kind = BoxKind.White;
            int          i    = 0;

            while (i < 12)
            {
                int j = 0;
                while (j < 12)
                {
                    float _i = i, _j = j;

                    if ((i % 2 == 0 && j % 2 == 1) || (i % 2 == 1 && j % 2 == 0))
                    {
                        if (i + j <= 8)
                        {
                            kind = BoxKind.Yellow;
                        }
                        else if (i + j > 8 && i + j <= 16)
                        {
                            kind = BoxKind.Purple;
                        }
                        else if (i + j > 16)
                        {
                            kind = BoxKind.Red;
                        }
                        ret.Add(new DXBox(kind, 96f + _j * 64f, 180f + _i * 32f));
                    }
                    j++;
                }
                i++;
            }
            return(ret);
        }
Beispiel #2
0
        private static List <DXBox> Level4()
        {
            List <DXBox> ret  = new List <DXBox>();
            BoxKind      kind = BoxKind.White;
            int          i    = 2;

            while (i < 10)
            {
                int j = 2;
                while (j < 10)
                {
                    float _i = i, _j = j;
                    if (i == 2 || i == 9 || j == 2 || j == 9)
                    {
                        kind = BoxKind.Yellow;
                    }
                    else if (i == 3 || i == 8 || j == 3 || j == 8)
                    {
                        kind = BoxKind.White;
                    }
                    else if (i == 4 || i == 7 || j == 4 || j == 7)
                    {
                        kind = BoxKind.Red;
                    }
                    else if (i == 5 || i == 6 || j == 5 || j == 6)
                    {
                        kind = BoxKind.Blue;
                    }
                    ret.Add(new DXBox(kind, 96f + _j * 64f, 180f + _i * 32f));
                    j++;
                }
                i++;
            }
            return(ret);
        }
Beispiel #3
0
        private static List <DXBox> Level3()
        {
            List <DXBox> ret  = new List <DXBox>();
            BoxKind      kind = BoxKind.White;
            int          i    = 0;

            while (i < 12)
            {
                int j = 0;
                while (j < 12)
                {
                    float _i = i, _j = j;
                    if ((i - 12) * (i - 12) + 2 * (j - 5) * (j - 6) > 36)
                    {
                        if (j < 2 || (j >= 6 && j < 8))
                        {
                            kind = BoxKind.Green;
                        }
                        else if ((j >= 2 && j < 4) || (j >= 8 && j < 10))
                        {
                            kind = BoxKind.Blue;
                        }
                        else if ((j >= 4 && j < 6) || j >= 10)
                        {
                            kind = BoxKind.Purple;
                        }
                        ret.Add(new DXBox(kind, 96f + _j * 64f, 180f + _i * 32f));
                    }
                    j++;
                }
                i++;
            }
            return(ret);
        }
Beispiel #4
0
        private void _chooseResourcePicture(BoxKind _kind)
        {
            switch (_kind)
            {
            case BoxKind.Red: resPicture = Properties.Resources.redbox; break;

            case BoxKind.Green: resPicture = Properties.Resources.greenbox; break;

            case BoxKind.Blue: resPicture = Properties.Resources.bluebox; break;

            case BoxKind.Purple: resPicture = Properties.Resources.purplebox; break;

            case BoxKind.Yellow: resPicture = Properties.Resources.yellowbox; break;

            case BoxKind.Cyan: resPicture = Properties.Resources.cyanbox; break;

            case BoxKind.DarkRed: resPicture = Properties.Resources.darkredbox; break;

            case BoxKind.DarkGreen: resPicture = Properties.Resources.darkgreenbox; break;

            case BoxKind.DarkBlue: resPicture = Properties.Resources.darkbluebox; break;

            case BoxKind.DarkGray: resPicture = Properties.Resources.darkgraybox; break;

            case BoxKind.White: resPicture = Properties.Resources.whitebox; break;
            }
        }
Beispiel #5
0
 public DXBox(BoxKind _kind, float _posX, float _posY)
 {
     kind = _kind; posX = _posX; posY = _posY; Broken = false; Touched = false;
     _chooseResourcePicture(_kind);
     boxBrush     = new TextureBrush(resPicture);
     boxRectangle = new RectangleF(posX, posY, 64f, 32f);
     PutBox();
 }
Beispiel #6
0
        private static List <DXBox> Level1()
        {
            List <DXBox> ret  = new List <DXBox>();
            BoxKind      kind = BoxKind.Blue;

            int i = 0;

            while (i < 8)
            {
                int j = 0;
                while (j < 12)
                {
                    float _i = i, _j = j;

                    if (i == 0)
                    {
                        if (j % 2 == 0)
                        {
                            kind = BoxKind.Yellow;
                        }
                        else
                        {
                            kind = BoxKind.Cyan;
                        }
                    }
                    else if (i % 3 == 1)
                    {
                        if (j % 2 == 0)
                        {
                            kind = BoxKind.Green;
                        }
                        else
                        {
                            kind = BoxKind.Purple;
                        }
                    }
                    else if (i % 3 == 2)
                    {
                        if (j % 2 == 0)
                        {
                            kind = BoxKind.Red;
                        }
                        else
                        {
                            kind = BoxKind.Blue;
                        }
                    }
                    else if (i % 3 == 0)
                    {
                        if (j % 2 == 0)
                        {
                            kind = BoxKind.Blue;
                        }
                        else
                        {
                            kind = BoxKind.Red;
                        }
                    }
                    ret.Add(new DXBox(kind, 96f + _j * 64f, 180f + _i * 32f));
                    j++;
                }
                i++;
            }

            return(ret);
        }