예제 #1
0
        private void makeRow()
        {
            Block[] newArr      = new Block[heightCount];
            int     placeHolder = r.Next(1, newArr.Length - 3);

            for (int j = 0; j < newArr.Length; j++)
            {
                int a = 0;

                if (j == placeHolder || j == placeHolder + 1 || j == placeHolder + 2)
                {
                    a = 0;
                }
                else
                {
                    a = 1;
                }

                Vector2 posHolder = new Vector2(lastPos * GameConf.BlockSize, j * GameConf.BlockSize);

                int y = 0;
                if (j == (placeHolder - 1))
                {
                    y = 2;
                }
                else if (j == (placeHolder + 3))
                {
                    y = 0;
                }
                else
                {
                    y = 1;
                }

                Rectangle visHolder = new Rectangle(0, y * GameConf.BlockSize, GameConf.BlockSize, GameConf.BlockSize);

                switch (a)
                {
                case 00: newArr[j] = new GateBlock(posHolder, visHolder); break;

                case 01: newArr[j] = new StaticBlock(posHolder, visHolder); break;
                }
            }

            lastPos++;
            blockList.Add(newArr);
            addEmptyRows(4);
        }
예제 #2
0
        private void convertToBlockList()
        {
            blockList = new List <Block[]>();

            for (int x = 0; x < byteList.Count; x++)
            {
                Block[] newArr = new Block[byteList[x].Length];

                for (int y = 0; y < newArr.Length; y++)
                {
                    Vector2   posHolder = new Vector2(x * GameConf.BlockSize, y * GameConf.BlockSize);
                    Rectangle visHolder = new Rectangle(0, 0, 160, 160);

                    switch (byteList[x][y])
                    {
                    case 00: newArr[y] = null; break;

                    case 01: newArr[y] = new StaticBlock(posHolder, visHolder); break;
                    }
                }

                blockList.Add(newArr);
            }
        }