Hi, there. i’m sorry to my poor knowlage.
in my opinion, if call a constructor, the parameter should be same as the constructor definition. but i learned from this lecture, it seems it is not like as my mind. GridObject is a contructor class
public class GridSystem
{
private int width;//declare the grid width
private int height;//declare the gird height
private float cellSize;
private GridObject[,] gridObjectsArray;//declare an array include gridsystem and gridposition
public GridSystem(int _width, int _height, float _cellSize)//class constructor
{
this.width = _width;
this.height = _height;
this.cellSize = _cellSize;
*gridObjectsArray = new GridObject[this.width, this.height];//assign gridobjectarray[width,height]*
* **//but without constuctor parameter???***
for (int x = 0; x < _width; x++)//iterate the width
{
for (int z = 0; z < _height; z++)//iterate the height
{
//drawling(startpostion each grid, endpostion each grid,color,show time);
//Debug.DrawLine(GetWorldPosition(x, z), GetWorldPosition(x, z) + Vector3.right * .2f, Color.white, 1000f);
GridPosition gridPosition = new GridPosition(x, z);
gridObjectsArray[x, z] = new GridObject(this, gridPosition);
}
}
}
```