Пример #1
0
        public void onInit(Vector2 position, int row, int colum, float cellWidth, float cellHeight)
        {
            this.ClearAll();
            this.size = new Vector2(row, colum);
            this.cellSize = new Vector2(cellWidth, cellHeight);
            this.position = position;

            for (int i = 0; i < (row * colum); ++i)
            {
                Vector2 cellLocation = new Vector2(i/colum, i%colum);
                Cell cell = new Cell();
                cell.onInit(cellWidth, cellHeight, cellLocation, new Vector2(position.X + cellLocation.Y * cellSize.X, position.Y + cellLocation.X * cellSize.Y));

                cells.Add(cell);
            }
        }
Пример #2
0
        private void SwitchList(Cell cell)
        {
            if (openList.Contains(cell))
                openList.Remove(cell);

            if (!closedList.Contains(cell))
                closedList.Add(cell);
        }