Exemple #1
0
        public Grid(int SquareSize, int defDist)
        {
            gridSquares = new Squares[GameManager.WIDTH, GameManager.HEIGHT];

            for (int y = 0; y < GameManager.HEIGHT; y++)
            {
                for (int x = 0; x < GameManager.WIDTH; x++)
                {
                    gridSquares[x, y] = new Squares(SquareSize, new Vector2(x * SquareSize + GameManager.BORDERLEFT, y * SquareSize + GameManager.BORDERTOP), x, y, defDist);
                }
            }

            gridBorder  = new Vector2(gridSquares[0, 0].sqrLoc.X, gridSquares[0, 0].sqrLoc.Y);
            gridStatus  = gridFlags.empty;
            updateTimer = TimeSpan.Zero;

            GenerateNewMap();

            gridSquares[(int)GameManager.ENDPOINT.x, (int)GameManager.ENDPOINT.y].typeOfSquare |= Squares.SqrFlags.StopPoint;
            gridSquares[(int)GameManager.ENDPOINT.x, (int)GameManager.ENDPOINT.y].Building      = Squares.BuildingType.Base;


            gridStatus = gridFlags.endPoint;
            pathFound  = GridManager.GridPaths(gridSquares);
        }
Exemple #2
0
        public Grid(int SquareSize, int defDist)
        {
            gridSquares = new Squares[GameManager.WIDTH, GameManager.HEIGHT];

            for (int y = 0; y < GameManager.HEIGHT; y++)
                for (int x = 0; x < GameManager.WIDTH; x++)
                    gridSquares[x, y] = new Squares(SquareSize, new Vector2(x * SquareSize + GameManager.BORDERLEFT, y * SquareSize + GameManager.BORDERTOP), x, y, defDist);

            gridBorder = new Vector2(gridSquares[0, 0].sqrLoc.X, gridSquares[0, 0].sqrLoc.Y);
            gridStatus = gridFlags.empty;
            updateTimer = TimeSpan.Zero;

            GenerateNewMap();

            gridSquares[(int)GameManager.ENDPOINT.x, (int)GameManager.ENDPOINT.y].typeOfSquare |= Squares.SqrFlags.StopPoint;
            gridSquares[(int)GameManager.ENDPOINT.x, (int)GameManager.ENDPOINT.y].Building = Squares.BuildingType.Base;
            

            gridStatus = gridFlags.endPoint;
            pathFound = GridManager.GridPaths(gridSquares);
            
        }