Esempio n. 1
0
        public override void setBlocksPos(int x, int y)
        {
            DoubleBlock b1 = (DoubleBlock)blocks[0];
            DoubleBlock b2 = (DoubleBlock)blocks[1];

            setX(x);
            setY(y);
            b1.setBlocksPos(x, y - 1);
            b2.setBlocksPos(x, y);
            blocks[0] = b1;
            blocks[1] = b2;
        }
Esempio n. 2
0
        public override void setBlocksPos(int x, int y)
        {
            SingleBlock b1 = (SingleBlock)blocks[0];
            SingleBlock b2 = (SingleBlock)blocks[1];
            DoubleBlock b3 = (DoubleBlock)blocks[2];

            setX(x);
            setY(y);
            switch (this.rot)
            {
            case 1:
                b1.setBlocksPos(x, y - 1);
                b2.setBlocksPos(x - 1, y - 1);
                b3.setBlocksPos(x, y);
                break;

            case 2:
                b1.setBlocksPos(x, y + 1);
                b2.setBlocksPos(x + 1, y - 1);
                b3.setBlocksPos(x, y);
                break;

            case 3:
                b1.setBlocksPos(x, y + 1);
                b2.setBlocksPos(x + 1, y + 1);
                b3.setBlocksPos(x - 1, y);
                break;

            case 4:
                b1.setBlocksPos(x, y - 1);
                b2.setBlocksPos(x - 1, y + 1);
                b3.setBlocksPos(x - 1, y);
                break;
            }
            blocks[0] = b1;
            blocks[1] = b2;
            blocks[2] = b3;
        }
Esempio n. 3
0
        public override List <KeyValuePair <int, int> > getPos()
        {
            List <KeyValuePair <int, int> > poses = new List <KeyValuePair <int, int> >();

            for (int i = 0; i < blocks.Count; i++)
            {
                DoubleBlock db = blocks[i] as DoubleBlock;
                SingleBlock sb = blocks[i] as SingleBlock;
                if (db != null)
                {
                    // double block
                    List <KeyValuePair <int, int> > dbpos = db.getPos();
                    poses.AddRange(dbpos);
                }
                else if (sb != null)
                {
                    // is singleblock
                    List <KeyValuePair <int, int> > sbpos = sb.getPos();
                    poses.AddRange(sbpos);
                }
            }
            return(poses);
        }