public MazeCell InitializeCell(int x, int y) { MazeCell newCell = Instantiate(mazeCellPrefab) as MazeCell; cells[x, y] = newCell; newCell.x = x; newCell.y = y; newCell.InitializeEdges(); newCell.SetCoord((3 * (x - size_x * 0.5f + 0.5f) + shiftX * size_x * 3), (3 * (y - size_y * 0.5f + 0.5f) + shiftY * size_y * 3)); newCell.name = mazeKey + " Cell: [" + x + "][" + y + "]"; newCell.transform.parent = transform; //Initialize the position of the cell (A cell is 1 unit large) newCell.transform.localPosition = new Vector3(newCell.coordX, 0f, newCell.coordY); return(newCell); }