public void Init() { fields = new PathFindableField[size.x][]; for (int x = 0; x < size.x; x++) { fields[x] = new PathFindableField[size.y]; for (int y = 0; y < size.y; y++) { fields[x][y] = new TestField(x, y, true); } } //fields[size.x - 1][size.y - 1].isAvailable = false; }
static PathFindableField[][] InitializeFields(Vector2Int size) { var fields = new PathFindableField[size.x][]; for (int x = 0; x < size.x; x++) { fields[x] = new PathFindableField[size.y]; for (int y = 0; y < size.y; y++) { fields[x][y] = new TestField(new Vector2Int(x, y)); } } fields[size.x - 1][size.y - 1].isAvailable = false; return(fields); }