Ejemplo n.º 1
0
        public CSquareGrid(int[,] tMap, float tSquareSize)
        {
            int tNodeCountX = tMap.GetLength(0);
            int tNodeCountY = tMap.GetLength(1);

            float tMapWidth  = tNodeCountX * tSquareSize;
            float tMapHeight = tNodeCountY * tSquareSize;

            CControlNode[,] tControlNodes = new CControlNode[tNodeCountX, tNodeCountY];

            Vector3 tPos;

            for (int tx = 0; tx < tNodeCountX; tx++)
            {
                for (int ty = 0; ty < tNodeCountY; ty++)
                {
                    tPos = new Vector3(-tMapWidth / 2 + tx * tSquareSize + tSquareSize / 2, 0, -tMapHeight / 2 + ty * tSquareSize + tSquareSize / 2);
                    tControlNodes[tx, ty] = new CControlNode(tPos, tMap[tx, ty] == 1, tSquareSize);
                }
            }

            mSquares = new CSquare[tNodeCountX - 1, tNodeCountY - 1];
            for (int tx = 0; tx < tNodeCountX - 1; tx++)
            {
                for (int ty = 0; ty < tNodeCountY - 1; ty++)
                {
                    mSquares[tx, ty] = new CSquare(tControlNodes[tx, ty + 1], tControlNodes[tx + 1, ty + 1], tControlNodes[tx + 1, ty], tControlNodes[tx, ty]);
                }
            }
        }
Ejemplo n.º 2
0
        private static void concreetSquare(int length)
        {
            CSquare square = new CSquare(length);

            Console.WriteLine("De omtrek is: {0}", square.GetPerimeter());
            Console.WriteLine("De oppervlakte is {0}", square.GetArea());
        }
Ejemplo n.º 3
0
 public EPiece this[CSquare square]
 {
     get { return(this[square.File, square.Rank]); }
     set { this[square.File, square.Rank] = value; }
 }
Ejemplo n.º 4
0
 public EPiece this[string coordinate]
 {
     get { return(this[CSquare.Parse(coordinate)]); }
     set { this[CSquare.Parse(coordinate)] = value; }
 }